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

suttles nginx-forum at nginx.us
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;
        # .domain.com will match both domain.com and
anything.domain.com
        server_name rentavault.net;
 
        # 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
'off'.
        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
rewrites
                # then replace the word @rewrites with /index.php
                try_files $uri $uri/ @rewrites;
        }
        location ~ ^/cgi-bin/(awredir|awstats)\.pl {
                gzip off;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_param SCRIPT_FILENAME
$document_root/cgi-bin/cgi-bin.php;
                fastcgi_param X_SCRIPT_FILENAME
                /home/www/rentavault_net/$fastcgi_script_name;
                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: http://forum.nginx.org/read.php?2,215921,216519#msg-216519



More information about the nginx mailing list