nginx代理服务器

hostnamectl set_hostname web1
_____________________________------
安装httpd
在www/html中
[root@web1 ~]# yum -y install httpd
[root@web1 ~]# cd /var/www/html/
[root@web1 html]# echo web1 > index.html
_
[root@web2 ~]# cd /var/www/html/
[root@web2 html]# echo web2 > index.html
[root@web2 html]# systemctl start httpd
[root@web2 html]# systemctl stop firewalld


upstream webserver{
server 192.168.2.100:80 weight=1 max_fails=2 fail_timeout=20;
server 192.168.2.200:80 weight=2;
}
_ httpd
_______
proxy_pass http://webserver;


     down : 直接停掉
     server 192.168.2.200:80 weight=2;
     _______________________
     [root@proxy sbin]# /usr/local/nginx/sbin/nginx -t            判断配置文件shifouzhengque

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful


[root@proxy sbin]# /usr/local/nginx/sbin/nginx -s reload


关掉nginx,并且删去rm -rf /usr/local/nginx/
[root@proxy nginx-1.12.2]# ./configure --with-stream --with-http_stub_status_module
make && make install


stream {
upstream backend {
server 192.168.2.100:22;
server 192.168.2.200:22;
}
server{
listen 12345 ;
proxy_pass backend ;
}


[root@room9pc01 ~]# ssh 192.168.4.5 -p 12345


rm -rf ~/.ssh/known_hosts (如果多连几次不能链接,就删掉)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值