Welcome! Log In Create A New Profile

Advanced

403 Error with hostname, but not IP

Cineron
August 25, 2011 09:36PM
Hi.

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

Here's the error message:
[error] 1140#0: *1 directory index of "/var/www/mysite.com/public/" is
forbidden, client: 99.46.122.45, 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/
mysite.com/public/*

==> What's weird is that I CAN navigate to the site if I use "
12.34.56.78/mysite.com/public" 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
--http-log-path=/var/log/nginx/access.log
--error-log-path=/var/log/nginx/error.log --with-http_stub_status_module
--with-ipv6 --with-http_ssl_module
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--http-proxy-temp-path=/var/lib/nginx/proxy
--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
--http-scgi-temp-path=/var/lib/nginx/scgi/


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.
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

403 Error with hostname, but not IP

Cineron August 25, 2011 09:36PM

Re: 403 Error with hostname, but not IP

Ensiferous August 26, 2011 12:23AM

Re: 403 Error with hostname, but not IP

Cineron August 26, 2011 10:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 168
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready