How to check which directive actually delivers the files?

rainer at ultra-secure.de rainer at ultra-secure.de
Tue Jan 26 12:09:59 UTC 2016


Hi,


I've setup nginx + php-fpm for a typo3.

It looks like this:

server {
     listen 80;
     server_name the_server;
     access_log /home/the_server/logs/nginx_access_log mycustom;
     error_log /home/the_server/logs/nginx_error_log;
     root /home/the_server/FTPROOT/htdocs ;
     index index.php;


        location = /favicon.ico {
                 log_not_found off;
                 access_log off;
        }

        location = /robots.txt {
                 allow all;
                 log_not_found off;
                 access_log off;
        }

        # Deny all attempts to access hidden files such as .htaccess, 
.htpasswd, .DS_Store (Mac).
        location ~ /\. {
                 deny all;
                 access_log off;
                 log_not_found off;
        }

     location ~ [^/]\.php(/|$) {
         include /usr/local/etc/nginx/fastcgi-includes.conf;
         fastcgi_param SCRIPT_FILENAME 
$document_root$fastcgi_script_name;
     	if (!-f $document_root$fastcgi_script_name) {
   	      return 404;
     	}

     	fastcgi_pass unix:/var/run/fastcgi/the_server.sock;
     	fastcgi_index index.php;
     	include fastcgi_params;
}
         client_max_body_size 100M;

         location ~ /\.(js|css)$ {
                 expires 604800s;
         }

         if (!-e $request_filename){
                 rewrite ^/(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ 
/$1.$3 last;
         }

         location ~* ^/fileadmin/(.*/)?_recycler_/ {
                 deny all;
         }
         location ~* ^/fileadmin/templates/.*(\.txt|\.ts)$ {
                 deny all;
         }
         location ~* ^/typo3conf/ext/[^/]+/Resources/Private/ {
                 deny all;
         }
         location ~* 
^/(typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) {
         }

         location / {
                         if ($query_string ~ ".+") {
                                 return 405;
                         }
                         if ($http_cookie ~ 
'nc_staticfilecache|be_typo_user|fe_typo_user' ) {
                                 return 405;
                         } # pass POST requests to PHP
                         if ($request_method !~ ^(GET|HEAD)$ ) {
                                 return 405;
                         }
                         if ($http_pragma = 'no-cache') {
                                 return 405;
                         }
                         if ($http_cache_control = 'no-cache') {
                                 return 405;
                         }
                         error_page 405 = @nocache;

                         try_files 
/typo3temp/tx_ncstaticfilecache/${scheme}/$host${request_uri}index.html 
@nocache;
         }

         location @nocache {
                         try_files $uri $uri/ /index.php$is_args$args;
         }
   }


However, I'm not sure if nginx actually delivers the static file.
The reason I'm not so sure is that I have varnish+nginx in front of this 
(on a different host) and varnish reports a "MISS" for what should be 
static deliveries from nginx.

I activated access-logging in the php-fpm pool and it looks like it's 
actually not working as intended.

So, how can I see what it's actually trying to do?








More information about the nginx mailing list