S
S
Stepan Gervik2019-07-31 11:52:18
Nginx
Stepan Gervik, 2019-07-31 11:52:18

Access denied error in nginx?

I installed the nginh server, put the index.php file in the root, but when I enter the page I see the message "Access denied". What could be wrong? Here is the nginh config:

server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name_;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
root /var/www/html;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Semyon Novikov, 2019-07-31
@semennovikov123

https://stackoverflow.com/questions/21909860/acces...
Try disabling SELinux, maybe that's the problem.

U
unwrecker, 2019-08-06
@unwrecker

1. You need to look at the nginx and php logs.
2. You can check without php: put the index.html file in the root of the server and upload it.
3. Check if the php socket is really located here: unix:/var/run/php/php7.2-fpm.sock

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question