Nginx always searches index.php in the wrong directory
Francis Daly
francis at daoine.org
Sat May 7 09:04:23 UTC 2016
On Fri, May 06, 2016 at 03:22:25PM -0400, Issam2204 wrote:
Hi there,
when I use your configuration and make some guesses about the content
and requests, it seems to work for me.
That is:
if the directory /var/www/html/chatserver does not exist,
then /var/www/html/index.php is processed; otherwise
/var/www/html/chatserver/index.php is processed.
> When I try to access http:// MYSERVER.net/chatserver I always have an error
> because Nginx tries to search for the index.php in the root web folder
> instead of the actual subfolder.
What output do you get from
curl -v http://MYSERVER.net/chatserver
? I expect a http 301 with a Location: of https://MYSERVER.net/chatserver
Do you get something else?
Then do another "curl -v" with whatever Location: you got.
Eventually you will get one url which shows the problem that you
report. What is that one url?
With that specific url, it should be possible to work out which location{}
you have told your nginx to use to handle it.
> rewrite ^(.*\.php)(/)(.*)$ $1?file=/$3 last;
> location / {
> location ^~ /.well-known/ {
> location ~ [^/]\.php(/|$) {
And from there, it may be more obvious where the problem that can be
solved is.
Cheers,
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list