nginx 反向代理是url带后缀

1.后端:http://10.253.149.2/tdsqlpcloud/index.php 

2.配置文件

danjan01deiMac:nginx danjan01$ cat  /usr/local/etc/nginx/uatconf.d/tdqsl.conf
server {
        listen       7777;
       server_name  172.19.134.43;  #不加端口
#        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

       location /tdsqlpcloud {
            index index.php index.html index.htm;
            proxy_pass http://10.253.149.2;   #后面不加后缀
            proxy_connect_timeout 3000s;
            proxy_send_timeout 3000s;
            proxy_read_timeout 3000s;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $host:$server_port;
            client_max_body_size    100m;
       }
}

$server_port :nigix监听的端口


$proxy_port : 服务器真正访问的端口

 

3.针对socket的配置

       proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_http_version 1.1;

 

posted @ 2019-06-14 17:52  littlevigra  阅读(6557)  评论(0编辑  收藏  举报