Having issues when I moved files from my old host to a Centos 7 droplet where when you visit those directories in a browser return a 403: Forbidden response.
The nginx error log shows the same thing, where permission is denied.
I have done the following to attempt to fix the nginx permissions:
cd /var/www
sudo chown -R nginx:nginx /var/www
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--
The resulting ls -lhA command shows nginx as the owner.
Nevertheless, a 403 persists.
I’ve sudo systemctl restart nginx php-fpm several times as well.
Configuration file contents /etc/nginx/conf.d/default.conf /etc/nginx/nginx.conf /etc/php-fpm.d/www.conf /etc/php.ini
I believe those are all the config files. If someone needs to look at something else I can provide it
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!
Hello,
After checking your config file and your permissions along with the logs that you’ve provided, I am pretty sure that the problem is due to an incorrect index file. This is actually one of the most common cause for 403 errors.
In your Nginx configuration file you have specified which index files should be loaded, and in which order:
index index.php index.html index.htm;
If none of those three files are found in the directory, Nginx would return a “403 Forbidden” error. According to the logs you are trying to access a folder called /var/www/html/stefano/ and you are getting a 403 so most likely you do not have a index file in that directory.
Hope that this helps! Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.