Question

403 Forbidden error

403 Forbidden error when visiting subdomain.example.com.

For the last few days I have been trying to setup a subdomain on my Nginx server for my website, the main website in the /var/www/html dictionary is working fine but can’t figure out the subdomain and example.com/forum ( with vanilla forum files are in the /var/www/html with my main domain name and have not made any changes to the config for forum when trying to install vanilla it goes to http://localhost/forum/dashboard/setup page rather than www.example.com/forum and setup link) if there is anything I need to change in the default config file for the forum please advise.

Regarding the subdomain.example.com I have setup a server with below config and have copied it to sites-enabled as well as sites-available but it still returns 403 error as mention above however when I place an a index.html file in the dictionary it loads fine but doesn’t work with WordPress files. Thanks in advance for any answers/help


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

        root /var/www/uk.watchallchannels.com/html;
        index index.html index.htm index.nginx-debian.html;

        server_name uk.watchallchannels.com;

        location / {
                try_files $uri $uri/ /index.php$is_args$args;
        }


        location = /favicon.ico { log_not_found off; access_log off; }
        location = /robots.txt { log_not_found off; access_log off; allow all; }
        location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
            expires max;
            log_not_found off;
        }
}

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Sorry to see that your question hasn’t received an answer yet. Unfortunately, without more information, it is unlikely that an answer for this specific issue can be provided.

Based on the error code, it is quite likely the problem had something to do with file permissions or ownership. A 403 error indicates that:

the user made a valid request but the server is refusing to serve the request, due to a lack of permission to access the requested resource. […] 403 errors commonly occur when the user that is running the web server process does not have sufficient permissions to read the file that is being accessed.

For more info on troubleshooting HTTP errors, check out:

Like in the WordPress tutorial you linked, make sure that the www-data user has access to the files.