Answer the question
In order to leave comments, you need to log in
How to configure nginx to work cms on php?
Help me set up nginx so that cms works correctly.
With the config below, only the root page of the server_name/index.php site is loaded,
and requests of the
server_name/oplata type give a 404 error. And there are other pages instead of oplata with different levels of nesting. Those. maybe server_name/oplata/first/second/third The
question is how to fix them?
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name доменное_имя_или_IP_адрес_сервера;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
Answer the question
In order to leave comments, you need to log in
location / { try_files $uri $uri/ =404; }
location / {
try_files $uri $uri/ /index.php;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question