【web】ngix代理配置

问题:

由于环境的登录节点只有1个是mesos的控制节点,无法网页查看mesos节点状态,因此配置nginx代理,方法如下

解决:

  1. nginx服务配置文件修改

[root@Cc4Tjbio ~]# whereis nginx

nginx: /usr/local/nginx

1.1 找到配置文件位置

[root@Cc4Tjbio conf]# pwd

/usr/local/nginx/conf

1.2 准备往配置文件中添加如下内容

[root@Cc4Tjbio conf]# vi nginx.conf

     server {

        listen 9999;

        #server_name localhost;

        location / {

                        proxy_set_header Upgrade $http_upgrade;

                        proxy_set_header Connection "upgrade";

                        proxy_http_version 1.1;

                        proxy_set_header Origin "";

                proxy_pass http://10.50.1.1:5050;

                #proxy_redirect default;

                }

        }

 

1.3查看可添加的端口,无人用即可使用

[root@Cc4Tjbio conf]# netstat -ntlp | grep 9995[q1] 

1.4 查看proxy又返回

Last login: Mon Apr 15 17:17:59 2019 from 192.168.5.50

[root@Cc4Tjbio ~]# nc -vv 10.50.1.1 5050

Ncat: Version 7.50 ( https://nmap.org/ncat )

NCAT DEBUG: Using system default trusted CA certificates and those in /usr/share/ncat/ca-bundle.crt.

NCAT DEBUG: Unable to load trusted CA certificates from /usr/share/ncat/ca-bundle.crt: error:02001002:system library:fopen:No such file or directory

libnsock nsi_new2(): nsi_new (IOD #1)

libnsock nsock_connect_tcp(): TCP connection requested to 10.50.1.1:5050 (IOD #1) EID 8

libnsock nsock_trace_handler_callback(): Callback: CONNECT SUCCESS for EID 8 [10.50.1.1:5050]

Ncat: Connected to 10.50.1.1:5050.

libnsock nsi_new2(): nsi_new (IOD #2)

libnsock nsock_read(): Read request from IOD #1 [10.50.1.1:5050] (timeout: -1ms) EID 18

libnsock nsock_readbytes(): Read request for 0 bytes from IOD #2 [peer unspecified] EID 26

 

1.4 添加1.2的内容到配置文件中

 

2 删除nginx服务

    pkill nginx

3 重启nginx服务

    ./usr/local/nginx/sbin/nginx

     ps –ef | grep nginx

4. 查看配置结果

查看服务:

[root@Cc4Tjbio conf]# netstat -ntlp | grep nginx

tcp        0      0 0.0.0.0:9996            0.0.0.0:*               LISTEN      46131/nginx: master

tcp        0      0 0.0.0.0:9997            0.0.0.0:*               LISTEN      46131/nginx: master

tcp        0      0 0.0.0.0:9998            0.0.0.0:*               LISTEN      46131/nginx: master

tcp        0      0 0.0.0.0:9999            0.0.0.0:*               LISTEN      46131/nginx: master

tcp        0      0 0.0.0.0:7791            0.0.0.0:*               LISTEN      46131/nginx: master

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      46131/nginx: master

 

5. 网页登录

 


}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值