在windows中使用nginx时报错:
C:\TDDOWNLOAD\nginx-1.6.0\nginx-1.6.0>nginx.exe -s reload
nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or insid
e "limit_except" block in C:\TDDOWNLOAD\nginx-1.6.0\nginx-1.6.0/conf/nginx.conf:61
我的nginx配置如下:
location ~* \.(jsp|do)$ { index index.jsp; proxy_pass http://localhost:8080/shop_goods; proxy_set_header X-Real-IP $remote_addr; }
为什么会报错呢?
因为location 使用了正则表达式(\.(jsp|do)$),而且proxy_pass中包含了URI part(shop_goods).错误提示的意思是:
如果location包含了正则表达式,则 "proxy_pass"不能包含URI part(shop_goods).
找到原因后,修改如下:
location ~* \.(jsp|do)$ { index index.jsp; proxy_pass http://localhost:8080; proxy_set_header X-Real-IP $remote_addr; }
注意:proxy_pass的值后面不要有斜杠,下面的是错误的:
proxy_pass http://localhost:8080/;
参考:http://huangkunlun520.blog.51cto.com/2562772/901974
nginx windows 安装包见附件
相关推荐
格式很简单: proxy_pass URL; 其中URL包含:传输协议(http://, https://等)、主机名(域名或者IP:PORT)、uri。 示例如下: proxy_pass http://www.xxx.com/; proxy_pass http://192.168.200.101:8080/uri; ...
proxy_pass http://server1/; } location /index { proxy_pass http://server2/; } 但是忘记了server1上有个服务路径是/indexNew,结果就被proxy到了server1,出现404问题,然后紧急修改配置如下: location /...
1、首先我们回顾一下nginx中location的相关知识 1)location的匹配指令: ~ #波浪线表示执行一个正则匹配,区分大小写 ~* #表示执行一个正则匹配,不区分大小写 ^~ #^~表示普通字符匹配,不是正则匹配。如果该...
2、反向代理proxy_pass 2.1、反向代理 2.2、反向代理-使用upstream 2.3、反向代理-负载均衡-轮循模式 2.4、反向代理-负载均衡-权重模式 2.4、反向代理-负载均衡-ip_hash方式 3、网关代理fastcgi_pass(php+nginx配合...
最近排查一个web服务的问题,webserver使用的nginx,最终发现是踩了nginx中proxy_pass的一个坑,这里记录下来。 踩坑经过 一个线上的http服务,示例nginx关键配置如下: server { listen 80; server_name ligang....
nginx中location中关于proxy_pass和rewrite的应用.rar
前言日常不管是研发还是运维,都多少会使用Nginx服务,很多情况Nginx用于反向代理,那就离不开使用proxy_pass,有些同学会对 proxy_pass
ngx_http_proxy_connect_module, 用于CONNECT请求处理的前向代理模块 名称 此模块为"连接"http方法提供支持,此方法主要用于... 目录 姓名 例子 安装 指令 proxy_connect proxy_connect_allow proxy_connect_connect_t
所以在这里用到了nginx的proxy_redirect指定修改被代理服务器返回的响应头中的location头域跟refresh头域数值 以下是截取nginx的一小段配置文档 server { listen 80; server_name www.boke.com; l
而在日常的web网站部署中,经常会用到nginx的proxy_pass反向代理,有一个配置需要弄清楚:配置proxy_pass时,当在后面的url加上了/,相当于是绝对根路径,则nginx不会把location中匹配的路径部分代理走;如果没有/,...
proxy_pass http://127.0.0.1:8008; } 或者可以 location / { proxy_pass http://127.0.0.1:8008; } Apache2的反向代理的配置是: ProxyPass /ysz/ http://localhost:8080/ 然而,如果要配置一个相对复杂的...
nginx_tcp_proxy_module-master.zip
1. proxy_pass配置说明 不带/ 代码如下: location /test/ { proxy_pass http://t6:8300; } 带/ 代码如下: location /test/ { proxy_pass http://t6:8300/; } 上面两种配置,区别只在于proxy_pass...
proxy_pass配置中url末尾带/时,nginx转发时,会将原uri去除location匹配表达式后的内容拼接在proxy_pass中url之后。 测试地址:http://192.168.171.129/test/tes.jsp 场景一: location ^~ /test/ { proxy_...
备用nginx代理模块
使用nginx作为http/https正向代理ipm包,包含ngx_http_proxy_connect_module 模块,附带了第三方图片代理配置,带有缓存,可直接做图片服务器 下载后执行:rpm -ivh nginx-1.12.2-1.el7_4.ngx.x86_64.rpm 打包教程:...
用于nginx的http正向代理https使用的模块