Error 403 forbidden nginx 1.4 6 Ubuntu

A nginx 403 forbidden error means that you have requested a resource from a server which it cannot send because you have insufficient rights to view it. Actually, it’s not a bug, it’s an HTTP 4xx, which merely stated, you do not have access to specific content.

Quite often such messages are shown to users, because they were blocked on the site or tried to access a file that is only available locally. In this article we will try to deal with cases where the appearance of the 403 forbidden nginx 1.4 6 Ubuntu is not desirable and represents an error that the web master or system administrator must solve. But first, consider the main reasons why you might see this message.

Error 403 Forbidden Nginx

So, error 403 forbidden nginx 1.4 6 Ubuntu can arise in such cases:

  • The user is blocked on the server by using a deny Directive in your nginx configuration;
  • Access to this resource is only allowed from specific IP address;
  • The user tries to access the folder, display the contents of which is prohibited;
  • Nginx can not read the contents of the requested file in the file system;
  • The index file is not found in the catalog.

This is the main reasons that occur most frequently. As you can see, the last two of them represent a problem. Consider how to solve it.

Wrong access rights set

If the file that is trying to get the user is billed incorrectly, it will be issued this error. You need to have Nginx was right not only to read the file, but reading all parent directories. You can check this with the command:

namei -l /var/www/public_html/index.html

All elements must be set the flag “r” is often better suited right 644, that is, the owner can do everything, but group and others only read. If the rights do not match, then you found the problem and it only remains to fix the rights with chmod. For example:

chmod 644 /var/www/public_html/index.html

That’s the way it should be:

Also note ownership of files and folders. If nginx needs to be able to perform back the recording, it might make sense to make the owner user nginx or later you will get another error. Also, if rights everything is OK, but error not solved try to disable SELinux, this service may be stopping Nginx to access the files.

If you use PHP and get this error, you still need to check whether Nginx can access the socket handler PHP. It is desirable that php-fpm runs with the same group as nginx, because, by default, to access a socket 660 (group and owner). So check the field listen.owner and in the file /etc/php5/fpm/php-fpm.conf.

You can also try to use a network socket and connect to the port, not the file.

Incorrectly configured index

The index file opens by default when you query a folder on the server in which it is located. If the file in the folder is missing or incorrectly configured in the configuration file of nginx, then the program will try to display the contents of the folder, and it is disabled by default, so you will get 403 Foribden.

To solve the problem, verify that the file index.html, index.php or how you call it, is need the folder that you are requesting. Check the configuration file and verify that it contains the “Index” Directive with the correct name and file extension:

If the Directive specifies only the html files, and you are using php, then it is clear why the program can’t find what you need. Just add the file name in the Directive:

index index.html index.htm index.php;

Similarly, if you used a python script, you need to add its extension.


In this article, we examined why there is a 403 forbidden error with nginx 1.4 6 Ubuntu and its solutions. This is the most common causes faced by users and after trying all this, you will likely solve your problem. If you have any questions, please ask in the comments!


(Visited 87 times, 1 visits today)