Nginx and PHP, subdirectories not working

Edho P Arief edho at myconan.net
Mon Jul 11 10:07:32 MSD 2011


On Mon, Jul 11, 2011 at 1:03 PM, copb.phoenix at gmail.com
<copb.phoenix at gmail.com> wrote:
> Hello list! Joined to post this but I'll be idle.
>
> I'm having problems with my setup for a server (Lucid x86). Because
> it's personal, I keep everything under the same root. I'm trying to
> get it to where I can run mediawiki, but I can't get php files to work
> in subdirectories. That is, with my root as /var/www,
> /var/www/test.php works fine but not /var/www/wiki/test.php
>
> My config file for nginx is posted, with changed extension, at:
> http://copb.sleepingwolf.net/roots/shared/nginxconfig.txt
>
> Likewise, the server config at:
> http://copb.sleepingwolf.net/roots/shared/serverconfig.txt
>
> Anyone have any advice on how to fix the problem? Reading files from
> all over the web and the wiki have me at my wits end ~ I have php5-fpm
> installed, for what it's worth... and, likewise, for example's sake:
>
> http://copb.sleepingwolf.net/phpcheck.php
> versus
> http://copb.sleepingwolf.net/nginx-default/phpcheck.php
>
> I assure you - the file is there in both cases, has the exact same
> permission settings at both directory and file level, and is exactly
> the same function call (phpinfo).
>

move
		root   /var/www/;
to top level (on `server { }` block, not `location / { }` block)

change this line
		fastcgi_param  SCRIPT_FILENAME  //var/www/nginx-default$fastcgi_script_name;
to this
		fastcgi_param  SCRIPT_FILENAME  $request_filename;



More information about the nginx mailing list