nginxreverse-proxycaddy

caddy to nginx conversion


I want to convert caddy to nginx but some configuration doesn't work. Some configuration I've shared as below.

caddy:

test-js.test.com.tr {
      import tls_config
        import access_log "js"
        root * /appdata/www/v1
        file_server
        import common_header
        header /v1/javascripts/* {
                Cache-Control "no-cache, no-store, must-revalidate"
                Pragma "no-cache"
                Expires 0
        }
}

nginx:

server {
listen 9625;
server_name test-js.test.com.tr;;
error_page 404 =200 /index.html;
location ~* \.(js|jpg|png|css)$ {
    root /appdata/www/v1;
    expires 30d;
}

Solution

  • here you are my solution that as below, I've update with alias and it was resolved.

        location /v1/javascripts/ {
            alias /appdata/www/v1/javascripts/;
            expires 0;
            add_header Cache-Control "no-cache, no-store, must-revalidate";
            add_header Pragma "no-cache";        
            }
    }