Q
Q
quorman2019-03-06 15:53:10
Nginx
quorman, 2019-03-06 15:53:10

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

2 answer(s)
D
dodo512, 2019-03-06
@dodo512

location / {
        try_files $uri $uri/ =404;
    }

location / {
        try_files $uri $uri/ /index.php;
    }

Q
quorman, 2019-03-07
@quorman

Does not help

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question