Answer the question
In order to leave comments, you need to log in
Why is php not working when issuing index.php via try_files $uri/index.php?
There is a server that I used for about a year only for the sake of a proxy.
Then I wanted to learn how to write something simple in PHP and ran into a problem
When requesting site.com , index.php is issued, which lies at the root (classic). But the problem is that the php script is not processed. If we turn to site.com/index.php, then php is processed normally. It seems that the nginx settings were set correctly, but something didn’t work ...
Server config:
location / {
autoindex off;
try_files $uri/index.php $uri/index.html =404;
}
location ~ \.php$ {
try_files $uri $uri/index.php =404;
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
Answer the question
In order to leave comments, you need to log in
In location / {...}
you need to write:
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question