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

**URL:** <https://www.ruby-forum.com/t/what-is-the-purpose-of-this-location-block/235589>\
**Category:** NGINX\
**Created:** [July 2, 2013, 3:40am UTC](https://www.ruby-forum.com/t/what-is-the-purpose-of-this-location-block/235589 "2013-07-02T03:40:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [July 2, 2013, 3:40am UTC](https://www.ruby-forum.com/t/what-is-the-purpose-of-this-location-block/235589/1 "2013-07-02T03:40:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [July 2, 2013, 3:09pm UTC](https://www.ruby-forum.com/t/what-is-the-purpose-of-this-location-block/235589/2 "2013-07-02T15:09:08Z")

</div>

A maint mode switch sounds probable.

–  
Jonathan M.  
Oxford, London, UK  
[http://www.jpluscplusm.com/contact.html](http://www.jpluscplusm.com/contact.html)
