Welcome! Log In Create A New Profile

Advanced

What is the purpose of this "location {}" block?

Ben Johnson
July 01, 2013 09:42PM
I'm using ISPConfig3 and the default nginx vhost configuration template
includes the following:

location ~ \.php$ {
try_files /dcc5f1e779623ed233ada555c6142e42.htm @php;
}

location @php {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/web2.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}

What is the point of the first location block? Wouldn't the end-result
be exactly the same if the content of the second block were to be moved
into the first block, and the second block eliminated? For example:

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/web2.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}

Everything "works" just fine; I'm simply curious if there is some
non-obvious reason for this "try_files trick" with a file that will
never exist (that HTML file doesn't exist and seems to have a
randomly-generated name -- presumably to ensure that it will *never* exist).

Perhaps this file is created in "Maintenance Mode", thereby causing all
requests to be redirected to the maintenance message page?

Thanks!

-Ben
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

What is the purpose of this "location {}" block?

Ben Johnson July 01, 2013 09:42PM

Re: What is the purpose of this "location {}" block?

Jonathan Matthews July 02, 2013 09:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 241
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready