Question

"Forbidden - You don't have permission to access / on this server" Error

I followed the virtual hosts tutorial and set up apache for my domain name aditidentalcare.com. The website was loading perfectly but now I am suddenly getting this error.

Forbidden - You don’t have permission to access / on this server.

I don’t understand why!

Here is the aditidentalcare.com.conf

<VirtualHost *:80> ServerAdmin jogi@smashingpixels.in ServerName aditidentalcare.com ServerAlias www.aditidentalcare.com DocumentRoot /var/www/html/sites/aditidentalcare.com/public_html ErrorLog /error.log CustomLog /access.log combined </VirtualHost>

The permission for public_html is set to 750 and the owner:group is jogi:www-data

Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

@joginayak

You need to use chmod 755 instead of 750 on directories. Using 750 equates to users having read, write, and execute, groups having read and execute, and finally, world (i.e your visitors) having absolutely zero access, thus they will be forbidden from accessing and/or viewing the contents.

Bobby Iliev
Site Moderator
Site Moderator badge
January 22, 2021

Hello,

One more thing that I could suggest in addition to what already has been mentioned is that you could also check the user that your Apache service is running as and change the owner of your files:

  • Check the user that Apache is running with:
ps aux | grep -i apache

In most cases, it would be www-data unless it was changed.

  • After that once you have the user run:
chown -R www-data: /var/www/html/

Make sure to change the www-data user if this is not the one that your Apache service is running as.

Regards, Bobby

@srjcooldude @kasidkhan

if you were using a wordpress site, it could have quite possibly been caused by a corrupt .htaccess file. the simple fix is to resave permalinks twice in order to regenerate .htaccess.

you might be seeing the below error messages:

  1. “The REST API encountered an unexpected result” in site health
  2. “Publishing failed and invalid JSON response” upon updating or publishing posts or pages
  3. “Forbidden You don’t have permission to access this resource. Apache/2.4.41 (Ubuntu) Server at Port 80” when viewing posts or pages

br, tom

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more