403 Forbidden error

Posted October 9, 2017 7.7k views
NginxWordPressUbuntu 16.04

403 Forbidden error when visiting

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 ( 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 and setup link) if there is anything I need to change in the default config file for the forum please advise.

Regarding the 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/;
        index index.html index.htm index.nginx-debian.html;


        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

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.

Submit an Answer
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.