Re: why my php file in subdirectory doesn't work?

suttles nginx-forum at
Tue Oct 11 15:21:42 UTC 2011

I have the variable set, or at least I think I do. Here is my config for
the vhost.

server {
        client_max_body_size 20M;
        listen 1192;
        # will match both and
        # It is best to place the root of the server block at the server
level, and not the location level
        # any location block path will be relative to this root. 
        root /home/www/rentavault_net;
        # It's always good to set logs, note however you cannot turn off
the error log
        # setting error_log off; will simply create a file called
        access_log /home/www/rentavault_net/logs/access_log.log main;
        error_log /home/www/rentavault_net/logs/error_log.log info;
        # This can also go in the http { } level
        index index.php index.html;

        location / { 
                # if you're just using wordpress and don't want extra
                # then replace the word @rewrites with /index.php
                try_files $uri $uri/ @rewrites;
        location ~ ^/cgi-bin/(awredir|awstats)\.pl {
                gzip off;
                fastcgi_param SCRIPT_FILENAME
                fastcgi_param X_SCRIPT_FILENAME
                fastcgi_param X_SCRIPT_NAME $fastcgi_script_name;
                include fastcgi_params;

This config will not let me access the sub directory without index.php
in the path of the browser. Very frustrating.

Posted at Nginx Forum:,215921,216519#msg-216519

More information about the nginx mailing list