浏览 1k
大家的nginx的ERROR日志有做可视化监控嘛?有做的话有没有可以分享的文档参考一下>_<。
我记得之前陶老师公开课的时候好像讲过,又还给陶老师了,呜呜。(我也同步找一下)
按点赞数排序
按时间排序
公开课里介绍了3个简易的轻量级工具:
1、命令行工具ngxtop, https://github.com/lebinh/ngxtop
2、web页面goaccess, https://goaccess.io/get-started
3、web页面visitors,http://www.hping.org/visitors/
如果你有特别灵活的定制需求,或者集群规模巨大,或者已经搭建好了ELK,那还是推荐用ELK
1
回答于2020-10-30 10:23
根据你提供的配置和错误信息,有几个问题可能导致你无法访问多级目录的资源。下面是可能的解决方案:
1. 尝试一:访问/applet/img/user/fitness_logo2.png 提示404的配置:
```
location / {
root /app/docker/statics/web;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /applet {
root /app/docker/statics;
index index.html;
}
```
这个配置中,`location /applet` 指定了根目录为 `/app/docker/statics`,而你的资源实际路径是 `/app/docker/statics/applet`。因此,你需要在 `location /applet` 的配置中添加 `/applet` 部分,以便正确地指向资源路径。修改后的配置如下:
```
location / {
root /app/docker/statics/web;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /applet {
root /app/docker/statics;
index index.html;
try_files $uri $uri/ /applet$uri /applet$uri/ =404;
}
```
2. 尝试二:访问/applet/img/user/fitness_logo2.png 提示404的配置:
```
location / {
root /app/docker/statics/web;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /applet {
alias /app/docker/statics/applet;
}
```
在这个配置中,你使用了 `alias` 指令来映射 `/applet` 到 `/app/docker/statics/applet` 目录。但是,由于你的请求是 `/applet/img/user/fitness_logo2.png`,Nginx 尝试将请求 `/applet/img/user/fitness_logo2.png/` 解析为目录,并在该目录下寻找索引文件,导致出现错误。为了解决这个问题,你可以尝试在 `location /applet` 的配置中使用 `try_files` 指令来显式指定文件的匹配。修改后的配置如下:
```
location / {
root /app/docker/statics/web;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /applet {
alias /app/docker/statics/applet;
try_files $uri $uri/ =404;
}
```