Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to serve my static files with nginx. But even though I have tried many times, I could not do it. This is my configuration file:

    server {
    listen       80;
    server_name  sis;

location / {
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_param GATEWAY_INTERFACE CGI/1.1;
        fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
        fastcgi_param REMOTE_ADDR $remote_addr;
        fastcgi_param REMOTE_PORT $remote_port;
        fastcgi_param SERVER_ADDR $server_addr;
        fastcgi_param SERVER_PORT $server_port;
        fastcgi_param SERVER_NAME $server_name;
        fastcgi_param SERVER_PROTOCOL $server_protocol;
        fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        fastcgi_pass 127.0.0.1:8080;
        }

location /a {
        root /home/ilker;
        }

}

When I write localhost/a to my browser, I get: 403 Forbidden

And this is the ouptut of cat /var/log/nginx/error.log:

2011/11/12 06:46:36 [error] 13950#0: *2 open() "/home/ilker/a" failed (13: Permission denied), client: 127.0.0.1, server: sis, request: "GET /a HTTP/1.1", host: "localhost"

And lastly /home/ilker/a permissions:

drwxrwxrwx. 2 ilker ilker 4096 Nov 12 06:37 a
share|improve this question
    
1  
Thank you for your comment but it is not. The error on your link is stat error, but in my error log it is open error. –  İlker Dağlı Nov 12 '11 at 5:17
    
stat ~ execute, open ~ read. Also keep in mind that never chmod 777. –  quanta Nov 12 '11 at 5:28
1  
Are the permissions for /home/ilker open too? –  Shish Nov 12 '11 at 11:27
1  
Nginx is probably not running as the user ilker (by default the user is nginx). User directories do not usually have the search (x) permission for other set. As such, nginx will not be able to enter the directory and read a file contained within it, even if it has read permissions on that file. It must also have search permissions on every directory above the one in question. One possible solution may be to run nginx as ilker (change the user directive in /etc/nginx.conf). –  cyberx86 Nov 14 '11 at 1:48
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.