2 ym184767847 ym184767847 于 2016.03.02 20:46 提问

nginx代理 转发请求提示400错误

nginx作代理,相同的配置可以将请求转发到weblogic的7001端口,但是转发至8080端口报400错误;下面是配置文件和日志文件;即http://188.185.1.191:7001/是可以正常访问,但是http://188.185.1.191:8080无法正常访问,http://188.185.1.189:8080是可以正常访问;nginx安装在188.185.1.191服务器上;

=========================配置文件=========================

server
{
listen 7001;
server_name localhost;
location / {

#allow 36.0.16.106;
#deny all;

    proxy_redirect off;
    proxy_set_header Host $host:server_port;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_buffering off;
    proxy_pass http://188.185.1.189:7001/;

}
access_log logs/7002access.log;

}

server
{
listen 8080;
server_name localhost;
location / {
proxy_redirect off;
proxy_set_header Host $host:server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    #proxy_buffering off;
    proxy_pass http://188.185.1.189:8080/;
    }
    access_log logs/8080access.log;

}

=======================日志文件============================​

188.185.4.82 - - [02/Mar/2016:17:45:43 +0800] "\x03" 400 172 "-" "-"
188.185.4.82 - - [02/Mar/2016:19:11:06 +0800] "GET /index.jsp HTTP/1.1" 400 5 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.154 Safari/537.36 LBBROWSER"
188.185.4.82 - - [02/Mar/2016:19:11:09 +0800] "GET /favicon.ico HTTP/1.1" 400 5 "http://188.185.1.191:8080/index.jsp" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.154 Safari/537.36 LBBROWSER"
188.185.4.82 - - [02/Mar/2016:19:11:19 +0800] "GET /index.jsp HTTP/1.1" 400 5 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.154 Safari/537.36 LBBROWSER"
188.185.4.82 - - [02/Mar/2016:19:11:20 +0800] "GET /favicon.ico HTTP/1.1" 400 5 "http://188.185.1.191:8080/index.jsp" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.154 Safari/537.36 LBBROWSER"

1个回答

caozhy
caozhy   Ds   Rxr 2016.03.07 05:34
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!