1、进入多用户模式
3台虚拟机均做配置
[root@localhost ~]# systemctl set-default multi-user.target
[root@localhost ~]# reboot
2、IP规划
服务器A:
仅主机 192.168.154.128
NAT 192.168.242.5
[root@localhost ~]# nmcli connection modify ens33 ipv4.addresses 192.168.242.5/24 ipv4.method manual
[root@proxy ~]# nmcli connection modify ens33 ipv4.gateway 192.168.242.2
[root@localhost ~]# nmcli connection up ens33
[root@localhost ~]# ping 192.168.242.2
[root@localhost ~]# hostnamectl set-hostname proxy.com
服务器B:
192.168.242.100
[root@localhost ~]# nmcli connection modify ens33 ipv4.addresses 192.168.242.100/24 ipv4.method manual
[root@localhost ~]# nmcli connection up ens33
[root@localhost ~]# ping 192.168.242.2
[root@localhost ~]# hostnamectl set-hostname web100.com
服务器C:
192.168.242.200
[root@localhost ~]# nmcli connection modify ens33 ipv4.addresses 192.168.242.200/24 ipv4.method manual
[root@localhost ~]# nmcli connection up ens33
[root@localhost ~]# ping 192.168.242.2
[root@localhost ~]# hostnamectl set-hostname web200.com
3、下载lnmp安装文件
三台服务器上操作
[root@proxy ~]# wget ftp://192.168.7.66/lnmp.tar.gz
[root@proxy ~]# scp lnmp.tar.gz 192.168.242.100:/root
[root@proxy ~]# scp lnmp.tar.gz 192.168.242.200:/root
[root@proxy ~]# mount /dev/cdrom /mnt/
[root@proxy ~]# rm -rf /etc/yum.repos.d/*
[root@proxy ~]# yum-config-manager --add file:///mnt
[root@proxy ~]# echo gpgcheck=0 >> /etc/yum.repos.d/mnt.repo
[root@proxy ~]# yum clean all
[root@proxy ~]# yum repolist
[root@proxy ~]# firewall-cmd --set-default-zone=trusted
[root@proxy ~]# setenforce 0
[root@proxy ~]# yum -y install gcc pcre-devel openssl-devel
[root@proxy ~]# cd /root/lnmp_soft/nginx-1.12.2/
[root@proxy nginx-1.12.2]# ./configure --with-stream --with-http_ssl_module
[root@proxy nginx-1.12.2]# make && make install
[root@proxy nginx-1.12.2]# ln -s /usr/local/nginx/sbin/nginx /bin/
[root@proxy nginx-1.12.2]# nginx
web100
[root@web100 nginx-1.12.2]# echo 192.168.242.100 > /usr/local/nginx/html/index.html
web200
[root@web200 nginx-1.12.2]# echo 192.168.242.200 > /usr/local/nginx/html/index.html
代理服务器
[root@proxy ~]# vim /usr/local/nginx/conf/nginx.conf
upstream myweb{
server 192.168.242.100;
server 192.168.242.200;
}
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://myweb;
root html;
index index.html index.htm;
}
}
4、TCP/UDP代理
[root@proxy ~]# vim /usr/local/nginx/conf/nginx.conf
stream {
upstream backend {
server 192.168.242.100:22;
server 192.168.242.200:22;
}
server {
listen 12345;
proxy_connect_timeout 1s;
proxy_timeout 100s;
proxy_pass backend;
}
}
[root@proxy ~]#nginx -s reload
5、memchched
[root@web100 ~]# yum -y install memcached
[root@web100 ~]# yum -y install telnet
[root@web100 ~]# systemctl restart memcached
简单使用
使用教程:
http://www.runoob.com/memcached/memcached-tutorial.html