403 Error with hostname, but not IP

Cineron cineron+nginx at gmail.com
Fri Aug 26 01:34:03 UTC 2011


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/mysite.com/public/" is
forbidden, client:, server: mysite.com, request: "GET /
HTTP/1.1", host: "mysite.com"

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/nginx.pid
--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
--http-client-body-temp-path=/var/lib/nginx/body --with-http_geoip_module
--with-http_gzip_static_module --with-http_flv_module
--lock-path=/var/lock/nginx.lock --http-uwsgi-temp-path=/var/lib/nginx/uwsgi

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 text/xml
                    application/xml application/xml+rss text/javascript;

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


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

server {
listen 80;

server_name mysite.com;

root /var/www/mysite.com/public;

access_log /var/www/mysite.com/access.log;
 error_log /var/www/mysite.com/error.log;

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;
#from http://wiki.nginx.org/Wordpress
 #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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20110825/d7bea25e/attachment.html>

More information about the nginx mailing list