Forum: NGINX 403 Error with hostname, but not IP

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D40faeadf892bd0308ed1844910f3138?d=identicon&s=25 Cineron (Guest)
on 2011-08-26 03:35
(Received via mailing list)

I'm getting a 403 error when navigating to my Wordpress site served by

Here's the error message:
[error] 1140#0: *1 directory index of "/var/www/" is
forbidden, client:, server:, request: "GET /
HTTP/1.1", host: ""

I have chown www-data:www-data -R and  chmod 775 -R to the /var/www/*

==> What's weird is that I CAN navigate to the site if I use "" and it all works correctly.

Here's $ nginx -V
nginx: nginx version: nginx/1.0.5
nginx: built by gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
nginx: TLS SNI support enabled
nginx: configure arguments: --prefix=/var/www
--conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/
--sbin-path=/usr/sbin --user=www-data --group=www-data
--error-log-path=/var/log/nginx/error.log --with-http_stub_status_module
--with-ipv6 --with-http_ssl_module
--with-http_gzip_static_module --with-http_flv_module

Here's my nginx.conf file:
worker_processes  4;

events {
    worker_connections  1024;

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    limit_req_zone $binary_remote_addr zone=blitz:10m rate=5r/s;

    gzip  on;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_types      text/plain text/css application/x-javascript
                    application/xml application/xml+rss text/javascript;

    include /etc/nginx/backends.conf;
    include /etc/nginx/sites-enabled/*;


Here's /etc/nginx/sites-available/ file
server {
listen 80;
 rewrite ^/(.*)$1 permanent;

server {
listen 80;


root /var/www/;

access_log /var/www/;
 error_log /var/www/;

location / {
 try_files $uri $uri/ /index.php;

location /search { limit_req zone=blitz burst=3 nodelay; rewrite ^
/index.php; }

fastcgi_intercept_errors off;

location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
 expires max;
 #this is in the /etc/nginx/drop_wp.conf file
#log_not_found off;
 add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";

include php.conf;
include drop_wp.conf;

Here's the drop_wp.conf file
location = /favicon.ico { access_log off; log_not_found off; }
location ~ /\.          { access_log off; log_not_found off; deny all; }
location ~ ~$           { access_log off; log_not_found off; deny all; }

Any ideas on how to fix it?
Thanks in advance for your help.
2974d09ac2541e892966b762aad84943?d=identicon&s=25 Ensiferous (Guest)
on 2011-08-26 06:24
(Received via mailing list)

In your try_files in location / you have $uri/ as your second option.
This means that it will try to read the URI as a directory. Since you do
not have an index directive defined it will instead try to list the
content of the directory, which is not allowed by default.

You need to define an index directive either in your location
block or further up.

Posted at Nginx Forum:,214315,214317#msg-214317
D40faeadf892bd0308ed1844910f3138?d=identicon&s=25 Cineron (Guest)
on 2011-08-26 16:07
(Received via mailing list)
Thank you for spotting that error and sending me the link!  That solved
I would not have seen that omission for weeks, since I'm so new to
This topic is locked and can not be replied to.