Nginx总是自动添加内网端口

淡蓝 发布于 2015/12/28 10:28
阅读 409
收藏 0
Nginx代理了2个WEB服务,ecs服务使用8081端口,personal服务使用8082端口
Nginx服务器IP为:172.17.3.1
从内网访问ecs服务是访问http://172.17.3.1:8081/ecs
从内网访问personal服务是访问http://172.17.3.1:8082/personal
将172.17.3.1的8081端口映射到公网123.123.123.123的80
将172.17.3.1的8082端口映射到公网123.123.123.124的80
外网访问http://123.123.123.123可以正常打开Nginx的静态页面,但如果访问http://123.123.123.123/ecs这个地址就不能打开链接,地址栏的链接自动跳转为http://123.123.123.123:8081/ecs

personal服务也是同样问题,求助如何配置Nginx能在访问http://123.123.123.123/ecs这个链接时能正常打开页面(就行内网访问http://172.17.3.1:8081/ecs一样)

我是弄网络的,对应用软件不是很懂,负责配置Nginx的人又很Lo,如果哪位知道问题在哪,麻烦指出,以便我解决。万分感谢!
配置如下:
user  yycard;
worker_processes  1;


#error_log  /home/yycard/nginx/logs/error.log;
error_log  /home/yycard/nginx/logs/error.log  notice;
#error_log  /home/yycard/nginx/logs/error.log  info;


pid        /home/yycard/nginx/logs/nginx.pid;




events {
use epoll; 
worker_connections  1024;
}




http {
    include       mime.types;
    include    proxy_conf.conf;
    include fastcgi.conf;
    default_type  application/octet-stream;


    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';


    access_log  /home/yycard/nginx/logs/access.log  main;
server_names_hash_bucket_size 128;
client_header_buffer_size 2k;
large_client_header_buffers 4 4k;


    sendfile        on;
    tcp_nopush     on;


    #keepalive_timeout  0;
keepalive_timeout  65;
fastcgi_buffers 8 128k;
send_timeout 90;


    #gzip  on;

upstream  yypaycard {
ip_hash;
server 172.17.11.81:8088;
server 172.17.11.82:8088;
}
upstream  yypayonline {
ip_hash;
server 172.17.11.81:8080;
server 172.17.11.82:8080;
}


    server {
        listen       8081;
        server_name  172.17.3.1;


        #charset koi8-r;


        access_log  /home/yycard/nginx/logs/host.access.log  main;

location ~* \.(jpg|gif|png|js|css|cab|exe|html|htm|swf|flv|wma|wmv|asf|mp3|mmf|zip|rar)$ {
root /home/yycard/nginx/htmlcard/;
error_page 405 =200 $uri;
index  index.html index.htm;
autoindex on;
expires 30d;
}
location ~ ^/nginx_status/ { 
stub_status on;
access_log on; 
}


location /ecs{
#rewrite (.*)  http://123.123.123.123/ecs;
index  index.jsp index.html index.htm;
autoindex on;
proxy_pass      http://yypaycard;
}        
location /NginxStatus {
stub_status     on;
access_log      on;
auth_basic      "NginxStatus";
#auth_basic_user_file  conf/htpasswd;
}       
    }



加载中
返回顶部
顶部