【发布时间】:2016-03-29 00:10:21
【问题描述】:
下面是我的 nginx.conf 文件的相关部分。 当我删除 conf 文件中的初始位置块时,我只看到 js|css... 请求转发到我的后端服务器。我试图完成的是关闭这些扩展文件的 nginx 访问日志记录。
有人知道一种有效的 nginx 配置技术,可以让我关闭访问日志,但仍将这些请求转发到代理位置?
...
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
access_log off;
}
location / {
if ($ignore_ua) {
access_log off;
return 200;
}
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:7777/;
}
【问题讨论】:
标签: nginx