I have some problems with nginx with some location config, here is my config file:
user dev-ci;
location ~* /img/screenshots/ {
alias /dev/shm/screenshots/;
}
# other location with root and proxing to apache currently working propertly
My petition with browser is:
http://URL/img/screenshots/4336.jpg?id=85574
My nginx log is:
2012/04/23 08:49:40 [error] 13916#0: *2148 directory index of "/dev/shm/screenshots/" is forbidden, client: *.*.*.5, server: development, request: "GET /img/screenshots/4336.jpg/?id=85574 HTTP/1.1", host: "****.amazonaws.com:2000"
My ls -la from directory /dev/shm/screenshots/:
drwxrwxrwx 3 dev-ci dev-ci 80 2012-04-23 08:54 .
drwxrwxrwt 11 root root 260 2012-04-23 07:27 ..
-rw-r--r-- 1 dev-ci dev-ci 7450 2012-04-23 08:54 4336.jpg
drwxrwxrwx 2 root root 40 2012-04-23 07:25 errors
The nginx user running is: dev-ci (here we can see the ps aux | grep nginx)
root 1231 0.0 0.0 22052 1432 ? Ss 07:25 0:00 nginx: master process /usr/local/nginx/sbin/nginx
dev-ci 13916 0.0 0.0 22448 1760 ? S 08:48 0:00 nginx: worker process
Any idea why isn't working? I get 403 Forbidden error directly to nginx, so the first location is working, but it doesn't alias correctly. The nginx process has the same username as the file, the directory has 777, I tried to change the owner and group to dev-ci user with the same result. I need a bright idea, and soon...
Thanks!
You're not using location properly - it appears you're trying to use regex improperly.
This should work fine.
For further reference, see http://wiki.nginx.org/HttpCoreModule#alias