alexazhou / VeryNginx

A very powerful and friendly nginx base on lua-nginx-module( openresty ) which provide WAF, Control Panel, and Dashboards.
GNU Lesser General Public License v3.0
5.96k stars 957 forks source link

代理参数在哪里配置? #82

Open alanfans opened 8 years ago

alanfans commented 8 years ago

location ~ .(jsp|jspx|do)?$ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://tomcat_server;

这样的proxy_set_header参数怎么配置?

alexazhou commented 8 years ago

host 可以在 proxy_pass 规则中配置,如果值不为空,那么host 是设定的值,如果值为空,则会使用 nginx 的 $host

目前还没有支持对 X-Real-IP 和 X-Forwarded-For 进行设置,所以转发到后端的请求里面不会有这两项,以后版本会加上对这个的支持

alanfans commented 8 years ago

http://imgsrc.baidu.com/forum/pic/item/9f65fd36afc3793117f5578ce3c4b74542a9110f.jpg 像上图这样配置静态文件,为什么不起做用?这样配置有错么?日志里总是找不到nginx目录html下的文件。

alexazhou commented 8 years ago

这样配置 static file 应该没问题,效果是你访问 {域名}/index.html , nginx 会返回 /opt/data/movie/index.html

你说的不起作用,具体是什么情况呢?另外需要确保 verynginx 已经更新到 master 分支上最新的版本(排除以前版本可能有 bug 的影响 )

alanfans commented 8 years ago

好的,我再试试,谢谢

alanfans commented 8 years ago

周五重新拉一master,配置放回去就可以用了。thank you