Question

403 forbidden when configuring Nginx on Debian 10 (Linode platform)

Hi DigitalOceanteam,

I followed this instruction to set up Nginx on Debian (via Linode platform) https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-debian-10 Everything is good until the last step where it shows 403 instead of the index.html (typing mydomain.com).

I’m pretty stuck. I’d be grateful if you can help me detect what the problem is.

Best, Ethan


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

Hi there,

Make sure that you assign ownership of the directory in which the index.html file is.

sudo chmod -R 755 /var/www/your_domain

sudo chown -R $USER:$USER /var/www/your_domain/html

Also, the index.html file must be in the root configured directory that you added. So, if your config looks like this:

server {
        listen 80;
        listen [::]:80;

        root /var/www/your_domain/html;
        index index.html index.htm index.nginx-debian.html;

        server_name your_domain www.your_domain;

        location / {
                try_files $uri $uri/ =404;
        }
}

Then the index.html file should be in the /var/www/your_domain/html directory.

If you do all of this and the 403 still shows up, then check the Nginx error log to get some more information on what the problem could be. To do that just run this command:

tail -100 /var/log/nginx/error.log

Let me know if this helps.

Regards,

Boyan

That’s awesome. It works, many thanks for your detailed instructions. It saved me!

Try DigitalOcean for free

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

Sign up

Become a contributor for community

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

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.