WordPress Access Denied

If you have a Centos Server, and you have setup WordPress correctly:

  • Database is created
  • wp-config is set to correct database and user
  • yoursite.conf is correct

Then you probably have an SELinux issues. Do not disable SELinux permanently. You need to change the labels in order for your site to work.

To test temporarily disable SELinux

setenforce 0

If the site works, then you know it is an SELinux issue. Set SELinux back.

setenforce 1

Now change the labels

sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/yourwebsite(/.*)?"
sudo restorecon -Rv /var/www/html/yourwebsite