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;
        }
}

Subscribe
Share

Even setting up 3 Nginx Server Blocks https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04 for my two subdomains and one main domain forum.example.com, uk.watchallchannels.com and the main domain example.com and then following https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lemp-on-ubuntu-16-04 install WordPress I m still getting 403 error it’s the setup of a new server block that I m having issues with when I used the default server block I manage to install WordPress for the main domain but I struggled with a new server blocks for the subdomains as I mentioned above not sure where it is going wrong. please help. Thank you


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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.