浏览 1.2k
在内网环境,发现有些时候web服务响应很慢,经过打印日志,发现存在这样的情况:request_time有10秒左右,而upstream_response_time只有零点几秒的情况,看起来跟后端应用没什么关系,但不知该如何进一步排查,求指教,谢谢!
按点赞数排序
按时间排序
我尝试修改STREAM_MODULES为STREAM_FILTER_MODULES,仍然不奏效,查看auto/modules脚本中,并没有stream过滤模块
根据你提供的配置和错误信息,有几个问题可能导致你无法访问多级目录的资源。下面是可能的解决方案:
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;
}
```