Nginx目录列表已启用,但我没有看到所有文件
各位。我有几个指向单独文件夹中日志的符号链接Nginx目录列表已启用,但我没有看到所有文件,nginx,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 defau
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
我的错在哪里?提前感谢。您是否确保nginx用户可以读取丢失的文件
fpm.error.log -> /path/to/php/fpm/error/log
请注意,它还需要对所有父路径具有读取权限。您是否确保nginx用户可以读取丢失的文件
fpm.error.log -> /path/to/php/fpm/error/log
请注意,它还需要对所有父路径具有读取权限。这是非常旧的,但如果其他人出现,如果标签设置不正确,这也可能是由SELinux或apparmour造成的。快速测试设置强制0(如果可以)。否则,请确保标签正确
sudo chcon -Rt httpd_sys_content_t /your/path
这是非常古老的,但如果其他人出现,这也可能是由于SELinux或apparmour造成的,如果您的标签设置不正确。快速测试设置强制0(如果可以)。否则,请确保标签正确
sudo chcon -Rt httpd_sys_content_t /your/path
[root@serverphp fpm]#ls-la error.log-rw------1 nginx root 734 Sep 28 18:02 error.log
[root@serverphp fpm]#ls-la error.log-rw------1 nginx root 734 Sep 28 18:02 error.log