✓ Solved

NGINX: Error 403: Forbidden

I am trying to set up a nginx server to serve a static website. It is giving me 403 Forbidden. I have tried sudo chown -R nginx:nginx * in the /var/www/ directory and checked my config file. How can I get nginx to stop showing this error and serve my site properly? Any and all help is greatly appreciated!

OS: CentOS Stream 9



server {
    listen         80;
    listen         [::]:80;
    server_name    kiwisky.net www.kiwisky.net;
    root           /var/www/kiwisky.net;
    index          home.html;

    gzip             on;
    gzip_comp_level  3;
    gzip_types       text/plain text/css application/javascript image/*;

1 Reply

✓ Best Answer

I have finally fixed it!


cd /var/www
sudo chmod -R =rx /var/www/*
sudo chown -R nginx:nginx *
sudo systemctl restart nginx


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct