0

Nginx вместо "компиляции" php, тупо отдаёт его как файл. Подскажите плиз, что не так в конфиге

server {
    listen 443 ssl;
    server_name xxx.com;
    root /home/xxx/public/;

    index index.php index.html index.htm;

    access_log /var/log/nginx/access.log;
    error_log  /var/log/nginx/error.log info;


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

    }

    location ~ \.php\$ {
        include /etc/nginx/fastcgi.conf;
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
     }

    ssl_certificate /etc/letsencrypt/live/xxx.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/xxx.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}
server {
    if ($host = xxx.com) {
       return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name xxx.com;
    return 404; # managed by Certbot


}

1 ответ 1

1

Должно быть не

location ~ \.php\$ {

а

location ~ \.php$ {

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.