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 (如果多连几次不能链接,就删掉)