Override index.php for a subdirectory

Lorenzo Milesi maxxer at ufficyo.com
Tue Dec 17 11:26:16 UTC 2013

I need to override default index file for a subdirectory only.

My actual config (pretty much ubuntu's default):
server {
    listen 80 default_server;
    root /var/www;
    index index.php index.html index.htm;
    server_name localhost;
    location / { 
        try_files $uri $uri/ /index.html;
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_index index.php;
        include fastcgi_params;
    location ~ /\.ht {
        deny all;

Then in a second file I added:
server {
    location ~ /work/management_site/ {
        fastcgi_index index-maxxer.php;
        index  index-maxxer.php;
        try_files $uri index-maxxer.php?$args;

        set $fsn "/index-maxxer.php";
        fastcgi_param  SCRIPT_FILENAME  $document_root$fsn;

But doesn't work. 
How can I accomplish that?


Lorenzo Milesi - lorenzo.milesi at yetopen.it

YetOpen S.r.l. - http://www.yetopen.it/

More information about the nginx mailing list