Welcome! Log In Create A New Profile

Advanced

Re: 404 location problem

Maxim Dounin
January 13, 2010 09:58PM
Hello!

On Wed, Jan 13, 2010 at 09:31:34PM -0500, lnxa wrote:

> this configure
> can't visit www.abc.com/blog/index.php error 404
> but can visit www.abc.com/blog/info.txt
> I don't know how to do?
> please tell me! thanks.
>
>
> server {
> listen 80;
> server_name www.abc.com;
> root /data0/www/abc;

1. server root is /data0/www/abc.

> index index.htm index.html index.php;
>
> location /blog/ {
> root /data0/www;

2. location /blog/ has root redefined into /data0/www, so
"/blog/info.txt" will be searched in file "/data0/www/blog/info.txt".

> }
> #php fastcgi
> location ~ .*\.php?$ {

Just a side note: did you mean "~ \.php$"? Prefix ".*"
meaningless as it matches everything, and "?" looks strange since
you probably don't want ".ph" files to be passed to php.

> fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
> #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> include fastcgi.conf;

3. location ~ \.php$ has no root explicitly defined, and therefore
uses one inherited from server, i.e. "/data0/www/abc". So
"/blog/index.php" will be mapped into
"/data0/www/abc/blog/index.php".

Note: resulting file names in 2 and 3 are very different. If you
want them to be in the same directory - you probably want to
define identical roots for both locations (i.e. define correct
one in server and don't redefine in locations).

> }
>
>
> access_log /var/log/nginx/access.log main;
> }

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

404 location problem

lnxa January 13, 2010 09:31PM

Re: 404 location problem

Maxim Dounin January 13, 2010 09:58PM

Re: 404 location problem

lnxa January 13, 2010 10:21PM

Re: 404 location problem

lnxa January 13, 2010 10:41PM

Re: 404 location problem

Maxim Dounin January 14, 2010 05:10AM

Re: 404 location problem

lnxa January 14, 2010 08:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 141
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready