Cannot access website with 403 Forbidden error: You don't have permission to access / on this server

Refers to:

  • Plesk for Linux

Created:

2016-11-16 13:08:40 UTC

Modified:

2017-02-21 07:28:30 UTC

2

Was this article helpful?


Have more questions?

Submit a request

Cannot access website with 403 Forbidden error: You don't have permission to access / on this server

Symptoms

While trying to browse a website, the error 403 Forbidden  appears:

You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

The domain's error log /var/www/system/example.com/logs/error_log contains the following:

(13)Permission denied: /var/www/vhosts/example.com/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable, referer: http://example.com/

Or

[Sat Nov 12 20:33:11.802549 2016] [core:crit] [pid 5912:tid 140446212568832] (13)Permission denied: [client 203.0.113.2:39024] AH00529: /var/www/vhosts/example.com/httpdocs/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/vhosts/example.com/httpdocs/' is executable

Cause

Apache service does not have proper permissions to the vhost or httpdocs folder.

Resolution

For Debian:

  1. Find the username that is used by the Apache service. This username is defined in the APACHE_RUN_USER variable in /etc/apache2/envvars.

  2. Add that user to the psaserv group. For example, if the Apache user is www-data, you would add the user in the psaserv group as below:

    # usermod -a -G psaserv www-data
  3. Restart web server

    # service apache2 restart

For CentOS:

  1. Add the apache user to the psaserv group:
    # usermod -a -G psaserv apache
  2. Restart web server

    # service httpd restart
  3. If the above steps do not help, change folder permissions to 775:

    # chmod 775 /var/www/vhosts/example.com

Finally, check that the domain has the correct ownership. It should look like:

# ls -ld  /var/www/vhosts/example.com
drwx--x--- 5 ftp_user psaserv 4096 Aug 30 08:33 /var/www/vhosts/example.com
# ls -ld /var/www/vhosts/example.com/httpdocs
drwx--x--- 5 ftp_user psaserv 4096 Aug 30 08:33 /var/www/vhosts/example.com/httpdocs

Note: If the server is running on Proxmox VE, this configuration will not work as expected. Please contact Proxmox support for further assistance.

In case, of several domains are affected by the issue, fix ownership for their httpdocs directories:

# /usr/local/psa/bin/repair --restore-vhosts-permissions
Have more questions? Submit a request
Please sign in to leave a comment.