2013-09-28 13 views
1

everyone。我有幾個符號鏈接來記錄單獨的文件夾。Nginx目錄列表已啓用,但我沒有看到所有文件

drwxr-xr-x 2 root root 4096 Sep 28 14:00 . 
drwxr-xr-x 4 root root 4096 Sep 28 12:34 .. 
lrwxrwxrwx 1 root root 38 Sep 28 13:24 default.access.log -> /path/to/default/access/log 
lrwxrwxrwx 1 root root 37 Sep 28 13:24 default.error.log -> /path/to/default/error/log 
lrwxrwxrwx 1 root root 26 Sep 28 14:00 fpm.error.log -> /path/to/php/fpm/error/log 
-rw-r--r-- 1 root root 50 Sep 28 13:50 .htpasswd 
lrwxrwxrwx 1 root root 37 Sep 28 13:24 images.access.log -> /path/to/images/access/log; 
lrwxrwxrwx 1 root root 36 Sep 28 13:24 images.error.log -> /path/to/images/error/log; 

我想通過url來查看這個文件。我的nginx的配置:

server { 
    listen 80; 
    server_name servername; 

    root /path/to/root; 
    charset UTF-8; 

    access_log /path/to/access/log; 
    error_log /path/to/error/log; 

    location ~ \.htpasswd$ { 
     deny all; 
    } 

    location ~* \.log$ { 
     expires epoch; 
     log_not_found off; 
     add_header Content-Type text/plain; 
     auth_basic "Restricted"; 
     auth_basic_user_file /path/to/htpasswd; 
    } 

    location/{ 
     autoindex on; 
     auth_basic "Restricted"; 
     auth_basic_user_file /path/to/htpasswd; 
    } 
} 

它工作正常,但我只看到四個文件:

default.access.log  28-Sep-2013 14:19  3431596 
default.error.log   28-Sep-2013 13:40   728 
images.access.log   28-Sep-2013 14:18   415324 
images.error.log   28-Sep-2013 12:05    0 

哪裏是我的錯?提前致謝。

回答

1

您是否確定nginx用戶可以讀取丟失的文件?

fpm.error.log -> /path/to/php/fpm/error/log 

請注意,它也需要所有父路徑的讀取權限。

+0

'[root @ server php-fpm]#ls -la error.log -rw ------- 1 nginx root 734 Sep 28 18:02 error.log' – indapublic

+1

nginx是否具有讀取權限「父母」文件夾? –

+0

是的,你是對的。非常感謝你 – indapublic

相關問題