我是靠谱客的博主 鲤鱼面包,这篇文章主要介绍nginx多端口配置:同一个ip,不同域名,不同端口号,根据nginx配置来进行转发,现在分享给大家,希望可以做个参考。

http {
    upstream www {
        server xxx.xxx.xxx.xxx:8088 max_fails=3 fail_timeout=30s;
    }
    upstream bbs {
        server xxx.xxx.xxx.xxx:8080 max_fails=3 fail_timeout=30s;
    }

    server {
        listen 80;
        server_name www.abc.com;
            location / {
            index index.html index.php index.jsp index.htm;
            proxy_pass http://www;
            proxy_redirect off;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            #proxy_connect_timeout 90;
            #proxy_send_timeout 90;
            #proxy_read_timeout 90;
            #proxy_buffers 32 4K;
        }
        log_format '$remote_addr - $remote_user [$time_local] $request '
        '"$status" $body_bytes_sent "$http_referer" '
        '"$http_user_agent" "$http_x_forwarded_for"'
        '"$server_addr;" "$upstream_addr "';

    }
    server {
        listen 80;
        server_name bbs.abc.com ;
        location / {
            index index.html index.php index.jsp index.htm;
            proxy_pass http://bbs;
            proxy_redirect off;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            #proxy_connect_timeout 90;
            #proxy_send_timeout 90;
            #proxy_read_timeout 90;
            #proxy_buffers 32 4K;
        }
    }

}

最后

以上就是鲤鱼面包最近收集整理的关于nginx多端口配置:同一个ip,不同域名,不同端口号,根据nginx配置来进行转发的全部内容,更多相关nginx多端口配置:同一个ip内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(67)

评论列表共有 0 条评论

立即
投稿
返回
顶部