nginx反向代理,多个远程应用和相同的端口

时间:2020-03-27 09:27:52

标签: nginx reverse-proxy

我正在尝试将Nginx服务器设置为反向代理

我的目标是:

在导航器http://@IP nginx server/app1中的用户磁带时,他将被重定向到app1,该app1正在运行到另一台服务器

这是我的配置:

server 
    {
        client_max_body_size 100M;
        listen         80;
        server_name    172.16.20.15;
        fastcgi_hide_header Set-Cookie;
        location / {
        add_header Set-Cookie "lcid=1033;Domain=.ebrueggeman.com;Path=/;Max-Age=31536000";
            gzip_static on;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header X-Real_IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
            # This is necessary to pass the correct IP to be hashed
            real_ip_header X-Real-IP;
            root   html;
            index  index.html index.htm;

            try_files $uri $uri/ /index.html;

        }

        location /app/ {

            proxy_pass http://172.16.20.17:3333/ ;

            proxy_http_version 1.1;

            proxy_set_header Host  $host;

            proxy_buffering off;

            proxy_set_header Upgrade $http_upgrade;

            proxy_set_header Connection "Upgrade";

        }

        location /sam/ {

            proxy_pass http://172.16.20.17:4444/ ;

            proxy_http_version 1.1;

            proxy_set_header Host  $host;

            proxy_buffering off;

            proxy_set_header Upgrade $http_upgrade;

            proxy_set_header Connection "Upgrade";

        }

    }
}

Chrome浏览器显示:not found,当我录制https://172.16.20.15/app/

在我的配置中有广告的创意或代码吗?

谢谢

0 个答案:

没有答案