403 Forbidden error

October 9, 2017 1.4k views
Nginx WordPress Ubuntu 16.04

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;

1 comment
1 Answer

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.

by Mitchell Anicas
This guide focuses on identifying and troubleshooting the most commonly encountered HTTP error codes, i.e. 4xx and 5xx status codes, from a system administrator's perspective. There are many situations that could cause a web server to respond to a request with a particular error code--we will cover common potential causes and solutions.
Have another answer? Share your knowledge.