Answer the question
In order to leave comments, you need to log in
Why is WordPress giving a 403 forbidden nginx error on my site?
Greetings. The problem is that the site almost always gives 403 errors on the main page, and 404 on the inner pages. And in other browsers, usually the whole site starts up normally, without problems. But sometimes Mozilla writes the same errors.
I did the following:
1. Set the necessary permissions for folders/files
2. Disable/enable all plugins
3. Disable/enable caching
4. Change the Nginx configuration
There are no 403-404 errors registered in the site login logs, everything seems to be fine there.
It is noteworthy that when I cleared the cache / cookies in chrome, the site started up, after some time it crashed again, this time cleaning did not help. It still doesn't work on google. Hosting support says that everything is in order on their part, it's in WP. But in what direction to dig?
At the moment, the site opens only in MS Edge, other browsers show errors. I did my best, I really need help!
nginx config:
root /home/{username}/domains/{parent_domain};
location ~ /\. {
deny all;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ ^/wp-admin/includes/ {
deny all;
}
location ~* /wp-includes/js/tinymce/wp-tinymce.php {
allow all;
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php5-{domain}.sock;
}
location ~* /wp-includes/.*\.(php|php3|php4|php5|php6|phps|phtml)$ {
deny all;
}
location ~* /wp-content/.*\.(php|php3|php4|php5|php6|phps|phtml)$ {
deny all;
}
location ~* /modules/.*\.(php|php3|php4|php5|php6|phps|phtml)$ {
deny all;
}
location ~* /skins/.*\.(php|php3|php4|php5|php6|phps|phtml)$ {
deny all;
}
location = /xmlrpc.php {
deny all;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
location ~* /(?:uploads|files)/.*\.(php|php3|php4|php5|php6|phps|phtml)$ {
deny all;
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php5-{domain}.sock;
}
Answer the question
In order to leave comments, you need to log in
root /home/{username}/domains/{parent_domain};
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php5-{domain}.sock;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question