C
C
Crash2019-10-09 19:22:32
Nginx
Crash, 2019-10-09 19:22:32

Why is nginx giving 403 error in my case?

Config:

server {
    server_name rates.test www.rates.test;
    # listen *:443 default_server;
    
    root        /var/www/rates/backend/web;
    index       index.php;

    charset utf-8;
    client_max_body_size 20M;
    access_log  /var/log/nginx/rates.test.access.log;
    error_log   /var/log/nginx/rates.test.error.log;

    location / {
        # Redirect everything that isn't a real file to index.php
        try_files $uri $uri/ /index.php$is_args$args;
    }

    # uncomment to avoid processing of calls to non-existing static files by Yii
    location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {

        try_files $uri =404;
    }

    location ~ \.php$ {

        add_header X-Frame-Options $x_frame_options;

        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        try_files $uri =404;
    }
}

The essence of the problem: when requesting https://rates.test, it gives a 403 error. Of course, such a site address does not exist, it is registered as a virtual host (or how to put it more correctly). On the local machine in the hosts, I registered the server address, the transition is carried out to the right place.
No errors were found in the config, the check was successful, I restarted nginx.
The index.php file actually exists and is correct.
With the rights and the owner everything is fine.
Only port 443 (https) is open to me, can this be an error?

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