<div>Hi.</div><div><br></div><div>I'm getting a 403 error when navigating to my Wordpress site served by NginX. </div><div><br></div><div>Here's the error message:</div><div>[error] 1140#0: *1 directory index of "/var/www/<a href="http://mysite.com/public/" target="_blank">mysite.com/public/</a>" is forbidden, client: 99.46.122.45, server: <a href="http://mysite.com" target="_blank">mysite.com</a>, request: "GET / HTTP/1.1", host: "<a href="http://mysite.com" target="_blank">mysite.com</a>"</div>
<div><br></div><div>I have chown www-data:www-data -R and chmod 775 -R to the /var/www/<a href="http://mysite.com/public/*" target="_blank">mysite.com/public/*</a></div><div><br></div><div>==> What's weird is that I CAN navigate to the site if I use "<a href="http://12.34.56.78/mysite.com/public" target="_blank">12.34.56.78/mysite.com/public</a>" and it all works correctly. </div>
<div><div><br></div></div><div><br></div><div>Here's $ nginx -V</div><div>nginx: nginx version: nginx/1.0.5</div><div>nginx: built by gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5) </div><div>nginx: TLS SNI support enabled</div><div>
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/</div>
<div> </div><div><br></div><div>Here's my nginx.conf file:</div><div>####</div><div>worker_processes 4;</div><div><br></div><div><br></div><div>events {</div><div> worker_connections 1024;</div><div>}</div><div>
<br>
</div><div><br></div><div>http {</div><div> include mime.types;</div><div> default_type application/octet-stream;</div><div><br></div><div> sendfile on;</div><div><br></div><div> #keepalive_timeout 0;</div>
<div> keepalive_timeout 65;</div><div><br></div><div> </div><div> limit_req_zone $binary_remote_addr zone=blitz:10m rate=5r/s;</div><div> </div><div> gzip on;</div><div> gzip_comp_level 2;</div><div> gzip_proxied any; </div>
<div> gzip_types text/plain text/css application/x-javascript text/xml</div><div> application/xml application/xml+rss text/javascript;</div><div><br></div><div> include /etc/nginx/backends.conf;</div>
<div> include /etc/nginx/sites-enabled/*;</div><div><br></div><div>}</div><div>#####</div><div><br></div><div>Here's /etc/nginx/sites-available/<a href="http://mysite.com" target="_blank">mysite.com</a> file</div>
<div>####</div><div>
server {</div><div><span style="white-space:pre-wrap"> </span>listen<span style="white-space:pre-wrap"> </span>80;</div><div><span style="white-space:pre-wrap"> </span>server_name<span style="white-space:pre-wrap"> </span><a href="http://www.mysite.com" target="_blank">www.mysite.com</a>;</div>
<div><span style="white-space:pre-wrap"> </span>rewrite<span style="white-space:pre-wrap"> </span>^/(.*) <a href="http://mysite.com/$1" target="_blank">http://mysite.com/$1</a> permanent;</div><div><span style="white-space:pre-wrap"> </span>}</div>
<div><br></div><div><br></div><div>server {</div><div><span style="white-space:pre-wrap"> </span>listen 80;</div><div> </div><div><span style="white-space:pre-wrap"> </span>server_name <a href="http://mysite.com" target="_blank">mysite.com</a>;</div>
<div> </div><div><span style="white-space:pre-wrap"> </span>root /var/www/<a href="http://mysite.com/public" target="_blank">mysite.com/public</a>;</div><div> </div><div><span style="white-space:pre-wrap"> </span>access_log /var/www/<a href="http://mysite.com/access.log" target="_blank">mysite.com/access.log</a>;</div>
<div><span style="white-space:pre-wrap"> </span>error_log /var/www/<a href="http://mysite.com/error.log" target="_blank">mysite.com/error.log</a>;</div><div> </div><div><span style="white-space:pre-wrap"> </span>location / { </div>
<div><span style="white-space:pre-wrap"> </span>try_files $uri $uri/ /index.php; </div><div><span style="white-space:pre-wrap"> </span>}</div><div> </div><div><span style="white-space:pre-wrap"> </span>location /search { limit_req zone=blitz burst=3 nodelay; rewrite ^ /index.php; }</div>
<div> </div><div><span style="white-space:pre-wrap"> </span>fastcgi_intercept_errors off;</div><div> </div><div><span style="white-space:pre-wrap"> </span>location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {</div>
<div><span style="white-space:pre-wrap"> </span>expires max;</div><div><span style="white-space:pre-wrap"> </span>#from <a href="http://wiki.nginx.org/Wordpress" target="_blank">http://wiki.nginx.org/Wordpress</a></div>
<div><span style="white-space:pre-wrap"> </span>#this is in the /etc/nginx/drop_wp.conf file</div><div><span style="white-space:pre-wrap"> </span>#log_not_found<span style="white-space:pre-wrap"> </span>off;</div>
<div><span style="white-space:pre-wrap"> </span>add_header Pragma public;</div><div><span style="white-space:pre-wrap"> </span>add_header Cache-Control "public, must-revalidate, proxy-revalidate";</div>
<div><span style="white-space:pre-wrap"> </span>}</div><div> </div><div><span style="white-space:pre-wrap"> </span>include php.conf;</div><div><span style="white-space:pre-wrap"> </span>include drop_wp.conf;</div>
<div>}</div><div>####</div><div><br></div><div>Here's the drop_wp.conf file</div><div>####</div><div><div>location = /favicon.ico { access_log off; log_not_found off; }<span style="white-space:pre-wrap"> </span></div>
<div>location ~ /\. { access_log off; log_not_found off; deny all; }</div><div>location ~ ~$ { access_log off; log_not_found off; deny all; }</div></div><div>####</div><div><br></div><div><br></div><div>
Any ideas on how to fix it?</div><div>Thanks in advance for your help.</div>