1

It happened in the last day. I have a Centos server with many Wordpress sites. Some of them are working fine and some are giving 403 forbidden.

And when trying to reach concrete files, I get 404 not found.

This is a site not working. It gives 403 to the root and 404 to the files, for example when i try to go to www.example.com/readme.html or license.txt I get 404.

 www]# ls -la /var/www/example.com/
total 208
drwxr-xr-x.  7 nginx nginx  4096 Jul  6 23:28 .
drwx------. 25 nginx nginx  4096 May 29 03:00 ..
-rwxr-xr-x.  1 nginx nginx   418 Aug 19  2017 index.php
-rwxr-xr-x.  1 nginx nginx 19935 Apr  3 23:28 license.txt
-rwxr-xr-x.  1 nginx nginx  7413 Jul  5 13:47 readme.html
drwxr-xr-x.  2 root  root   4096 Jul  1 03:00 .well-known
-rwxr-xr-x.  1 nginx nginx  5447 Aug 19  2017 wp-activate.php
drwxr-xr-x. 10 nginx nginx  4096 Aug 21  2017 wp-admin
-rwxr-xr-x.  1 nginx nginx   364 Aug 19  2017 wp-blog-header.php
-rwxr-xr-x.  1 nginx nginx  1627 Aug 19  2017 wp-comments-post.php
-rwxr-xr-x.  1 nginx nginx  3301 Jul  8 07:30 wp-config.php
-rwxr-xr-x.  1 nginx nginx  2764 Aug 19  2017 wp-config-sample.php
drwxr-xr-x. 11 nginx nginx  4096 Jun 27 15:43 wp-content
-rwxr-xr-x.  1 nginx nginx  3286 Aug 19  2017 wp-cron.php
drwxr-xr-x. 18 nginx nginx 12288 Aug 19  2017 wp-includes
-rwxr-xr-x.  1 nginx nginx  2422 Aug 19  2017 wp-links-opml.php
-rwxr-xr-x.  1 nginx nginx  3301 Aug 19  2017 wp-load.php
-rwxr-xr-x.  1 nginx nginx 34337 Apr  3 23:28 wp-login.php
-rwxr-xr-x.  1 nginx nginx  8048 Aug 19  2017 wp-mail.php
-rwxr-xr-x.  1 nginx nginx 16200 Aug 19  2017 wp-settings.php
-rwxr-xr-x.  1 nginx nginx 29924 Aug 19  2017 wp-signup.php
drwxr-xr-x.  3 nginx nginx  4096 Jun 27 03:55 wp-snapshots
-rwxr-xr-x.  1 nginx nginx  4513 Aug 19  2017 wp-trackback.php
-rwxr-xr-x.  1 nginx nginx  3065 Aug 19  2017 xmlrpc.php

This is another one that has the same problem:

ls -la /var/www/problemsite.com/
total 204
drwxr-xr-x.  6 nginx nginx  4096 Jul  6 20:00 .
drwx------. 25 nginx nginx  4096 May 29 03:00 ..
-rw-r--r--.  1 nginx nginx   418 Oct 13  2017 index.php
-rw-r--r--.  1 nginx nginx 19935 Apr  3 22:23 license.txt
-rw-r--r--.  1 nginx nginx  7413 Jul  6 07:31 readme.html
drwxr-xr-x.  2 root  root   4096 Jun 29 03:00 .well-known
-rw-r--r--.  1 nginx nginx  5447 Oct 13  2017 wp-activate.php
drwxr-xr-x.  9 nginx nginx  4096 Oct 13  2017 wp-admin
-rw-r--r--.  1 nginx nginx   364 Oct 13  2017 wp-blog-header.php
-rw-r--r--.  1 nginx nginx  1627 Oct 13  2017 wp-comments-post.php
-rw-rw-rw-.  1 nginx nginx  3105 Oct 14  2017 wp-config.php
-rw-r--r--.  1 nginx nginx  3065 Oct 13  2017 wp-config-sample.php
drwxr-xr-x.  9 nginx nginx  4096 Jan 29 18:37 wp-content
-rw-r--r--.  1 nginx nginx  3286 Oct 13  2017 wp-cron.php
drwxr-xr-x. 18 nginx nginx 12288 Oct 13  2017 wp-includes
-rw-r--r--.  1 nginx nginx  2422 Oct 13  2017 wp-links-opml.php
-rw-r--r--.  1 nginx nginx  3301 Oct 13  2017 wp-load.php
-rw-r--r--.  1 nginx nginx 34337 Apr  3 22:23 wp-login.php
-rw-r--r--.  1 nginx nginx  8048 Oct 13  2017 wp-mail.php
-rw-r--r--.  1 nginx nginx 16200 Oct 13  2017 wp-settings.php
-rw-r--r--.  1 nginx nginx 29924 Oct 13  2017 wp-signup.php
-rw-r--r--.  1 nginx nginx  4513 Oct 13  2017 wp-trackback.php
-rw-r--r--.  1 nginx nginx  3065 Oct 13  2017 xmlrpc.php

And this is a site that works fine:

www]# ls -la /var/www/goodone.com/
total 224
drwxr-xr-x.  8 nginx nginx  4096 Jul  5 13:46 .
drwx------. 25 nginx nginx  4096 May 29 03:00 ..
-rwx------.  1 nginx nginx   418 May 23  2015 index.php
-rwxr--r--.  1 nginx nginx 19935 Jan 16 17:55 license.txt
-rwxr--r--.  1 nginx nginx  7415 Jul  5 13:46 readme.html
drwx------.  2 nginx nginx  4096 May 10  2017 uploads
drwxr-xr-x.  2 root  root   4096 May 15 03:00 .well-known
-rwxr--r--.  1 nginx nginx  5458 May 24 02:09 wp-activate.php
drwx------. 10 nginx nginx  4096 Nov 24  2017 wp-admin
-rwx------.  1 nginx nginx   364 May 12  2016 wp-blog-header.php
-rwxr--r--.  1 nginx nginx  1889 May 24 02:09 wp-comments-post.php
-rwx------.  1 nginx nginx  3686 Oct  6  2017 wp-config.php
-rwx------.  1 nginx nginx  2853 Jan  7  2016 wp-config-sample.php
drwx------. 14 nginx nginx  4096 Jun 19 13:11 wp-content
-rwxr--r--.  1 nginx nginx  3669 Nov 24  2017 wp-cron.php
drwx------. 18 nginx nginx 12288 Nov 24  2017 wp-includes
-rwxr--r--.  1 nginx nginx  2422 Jan 18  2017 wp-links-opml.php
-rwxr--r--.  1 nginx nginx  3306 Nov 24  2017 wp-load.php
-rwxr--r--.  1 nginx nginx 37760 May 24 02:09 wp-login.php
-rwxr--r--.  1 nginx nginx  8048 Jan 18  2017 wp-mail.php
-rwxr--r--.  1 nginx nginx 16246 Nov 24  2017 wp-settings.php
-rwxr--r--.  1 nginx nginx 30091 May 24 02:09 wp-signup.php
-rwxr--r--.  1 nginx nginx  4620 Nov 24  2017 wp-trackback.php
-rwxr--r--.  1 nginx nginx  3065 Jan 18  2017 xmlrpc.php

The root in the specific v host files in /etc/nginx/vhosts.d/ are the right ones.

These are some error.log:

2018/07/08 08:55:07 [crit] 11871#0: *1859 stat() "/var/www/example.com/license.txt" failed (13: Permission denied), client: 89.65.(myip), server: www.example.com, request: "GET /license.txt HTTP/1.1", host: "www.example.com"

2018/07/08 08:56:27 [error] 11871#0: *1898 "/var/www/example.com/index.php" is forbidden (13: Permission denied), client: 89.65.(myip), server: www.example.com, request: "GET / HTTP/1.1", host: www.example.com"

Any idea what can I check? It happened all alone. I didn't log in to SSH since few weeks. But today/yesterday some sites stopped working.

Please help

  • Try chmod 744 ./readme.html on example.com and problemsite.com and see if the example.com/readme.html is accessible afterwards. – Mario Werner Jul 8 '18 at 13:05
  • done. On example.com it's still accessible. On problemsite.com still says file not found: -rwxr--r--. 1 nginx nginx 7413 Jul 5 13:47 readme.html – Pikk Jul 8 '18 at 13:10
  • You said "when i try to go to www.example.com/readme.html [...] I get 404". So after chmod 744 ./readme.html on example.com it works now? – Mario Werner Jul 8 '18 at 13:12
  • ups sorry. I did chmod 744 ./readme.html to one working site and to one non working site. The non working site is giving the same error. The working site is still working good. I try to run the same command to another non working site. Done. still giving File not found. – Pikk Jul 8 '18 at 13:15
  • And all domains are on the same vhost? Are you sure that nginx:nginx is the right owner and group for the sites not working? – Mario Werner Jul 8 '18 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.