Friday, May 23, 2014

Avoid 403 forbidden error in NGINX

403 Forbidden error: 

 

In NGINX webserver, you will get 403 forbidden error when you created new directory and try to access it with URL. This error can be occurred for many reasons. Such as permission error, directory index error and others. Most of the time, it's just directory index error. In this tutorial, I am going to show you how to fix directory index error. Follow these simple steps to fix forbidden error.

 


Directory index fix:


Step 1: Login in webmin control panel as root. 
Step 2: Go to Webmin tab > Servers> Nginx webserver 
Step 3: Click "Edit Configuration Files" (accourding to your domain).
Step 4: Put "autoindex on;" (without quote) inside location / block.
 
Example:
location /  {
            root /var/www;
            index index.php index.html index.htm;
            autoindex on;
                 }
Step 5: Click "save" & then click "Apply Nginx Configuration".




Permission fix:


If the above fix doesn't solve 403 forbidden error problem, then give the appropriate permission for newly created folder.

Step 1: Browser you folder with favorite FTP client (i.e Filezilla)
Step 2: Give the newly created folder to 755 permission with FTP client.

Now, this error will be fixed.

No comments:

Post a Comment