- 打开/usr/local/nginx/conf/nginx.conf
vi /usr/local/nginx/conf/nginx.conf
upstream test1 {
server 192.168.0.190:8080;
}
upstream jenkins_t1 {
server 192.168.0.190:8088;
}
server {
listen 80;
server_name test.tieli.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_set_header Host $Host;
proxy_pass http://test1;
index index.html index.htm;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Port $Server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
listen 80;
server_name jenkins.tieli.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://jenkins_t1;
index index.html index.htm;
}
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
- 重启Nginx
./sbin/nginx -s reload
- 防火墙设置
#查看打开的端口
firewall-cmd --zone=public --list-ports
#禁用端口
firewall-cmd --zone=public --remove-port=8080/tcp --permanent
firewall-cmd --zone=public --remove-port=8088/tcp --permanent
# 更新防火墙
firewall-cmd --reload
网友评论