问题:
由于环境的登录节点只有1个是mesos的控制节点,无法网页查看mesos节点状态,因此配置nginx代理,方法如下
解决:
- 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. 网页登录
}