Nginx static files

Zhenyapan

Verified User
Joined
Feb 23, 2018
Messages
2,434
Location
UA
Hello,

We have next code in default nginx-template:

Code:
|*if HAVE_NGINX_PROXY="1"|
        location /
        {
|CUSTOM2|
                # access_log off;
                proxy_buffering |PROXY_BUFFERING|;
                proxy_pass http://|PROXY_IP|:|PORT_8080|;
                proxy_set_header X-Client-IP      $remote_addr;
                proxy_set_header X-Accel-Internal /nginx_static_files;
                proxy_set_header Host             $host;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_hide_header Upgrade;
        }
        location /nginx_static_files/
        {
                # access_log  /var/log/nginx/access_log_proxy;
                alias       |DOCROOT|/;
                internal;
        }
|*else|

But I can't find where described file-list for nginx_static_files which exact filetypes processed? How I can exclude few types or add new to serve?
 
it all files that can request directly without processing from php or other proxy pass.

Example: if you turn off PHP, it will show raw code from php-file by static serve content ( no proxy pass into backend Apache ).


So no way to exclude from Serve Static Content unless you create another Location rules without "X-Accel-Internal" to maching before process default rules.

Code:
|*if HAVE_NGINX_PROXY="1"|
        location /
        {
|CUSTOM2|
                # access_log off;
                proxy_buffering |PROXY_BUFFERING|;
                proxy_pass http://|PROXY_IP|:|PORT_8080|;
                proxy_set_header X-Client-IP $remote_addr;
                proxy_set_header X-Accel-Internal /nginx_static_files;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_hide_header Upgrade;
        }
        location /nginx_static_files/
        {
                # access_log /var/log/nginx/access_log_proxy;
                alias |DOCROOT|/;
                internal;
        }
location ~* .(ext1|ext2)$ {
   
proxy_buffering |PROXY_BUFFERING|;
                proxy_pass http://|PROXY_IP|:|PORT_8080|;
                proxy_set_header X-Client-IP      $remote_addr;
               
                proxy_set_header Host             $host;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_hide_header Upgrade;
}

this will serve .ext1 .ext2 from backend all the time.
 
Back
Top