Y
Y
yeszhanov2017-02-13 01:09:26
Nginx
yeszhanov, 2017-02-13 01:09:26

Why is nginx not reading the index.php file and getting a 403 Forbidden error?

Nginx does not see the index.php file, a 403 Forbidden error occurs, although if I change it to index.html everything works.
here is the config.

server {
    listen       80;
    server_name  localhost;

  
    root   /var/www/html;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ =404;
    }
    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /var/www/html;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question