Server2.example.com 172.25.85.2
Server4.example.com 172.25.85.4
Server5.example.com 172.25.85.5
1.nginx Source Code compilation:
Tar zxf nginx-1.9.14.tar.gz
cd/root/nginx-1.9.14/auto/cc
Vim GCC
# debug#cflags= "$CFLAGS-G"
Yum Install Pcre-devel openssl-devel-y
CD nginx-1.9.14
./configure--prefix=/usr/local/lnmp/nginx--with-http_ssl_module--with-http_stub_status_module # #编译成功
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/85/65/wKioL1eiIdzS3oJJAACDnfm1AvM419.png-wh_500x0-wm_3 -wmp_4-s_2148042797.png "title=" screenshot from 2016-07-20 22-31-37.png "alt=" Wkiol1eiidzs3ojjaacdnfm1avm419.png-wh _50 "/>
Make
Make install
Cd/root
Vim. Bash_profile
Path= $PATH: $HOME/bin:/usr/local/lnmp/mysql/bin:/usr/local/lnmp/nginx/sbin
Source. Bash_profile
cd/usr/local/lnmp/nginx/sbin/
./nginx-t
./nginx
curl-i localhost
useradd-s/sbin/nologin nginx
usermod-d/usr/local/lnmp/nginx/ nginx
cd /etc/pki/tls/certs
make cert.pem # #生成了cert. PEM
650) this.width=650; "Src=" http://s1.51cto.com/wyfs02/M00/85/65/wKioL1eiIiKwtvCCAAA2l5ZKfFM285.png-wh_500x0-wm_3-wmp _4-s_599657478.png "title=" screenshot from 2016-07-20 23-12-57.png "alt=" wkiol1eiiikwtvccaaa2l5zkffm285.png-wh_50 "/
CP cert.pem/usr/local/lnmp/nginx/conf/
nginx-t
nginx-s Reload
Access in Web page:/http server3.example.com Generates information about this key
cd /usr/local/lnmp/nginx/conf
Vim nginx.conf
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/85/65/wKiom1eiIrmjYjHmAAAjTAYDkQo299.png-wh_500x0-wm_3 -wmp_4-s_2291990900.png "style=" Float:none; "title=" screenshot from 2016-07-20 23-50-13.png "alt=" Wkiom1eiirmjyjhmaaajtaydkqo299.png-wh_50 "/>
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/85/65/wKioL1eiIrrzkWdLAAATItL3Qy4425.png-wh_500x0-wm_3 -wmp_4-s_1281644333.png "style=" Float:none; "title=" screenshot from 2016-07-20 23-50-31.png "alt=" Wkiol1eiirrzkwdlaaatitl3qy4425.png-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/85/65/wKiom1eiIrvB49PiAAAuqYXsMow534.png-wh_500x0-wm_3 -wmp_4-s_3209798995.png "style=" Float:none; "title=" screenshot from 2016-07-20 23-50-49.png "alt=" Wkiom1eiirvb49piaaauqyxsmow534.png-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/85/65/wKioL1eiIruxFovaAAASoBiFdU4157.png-wh_500x0-wm_3 -wmp_4-s_2498796623.png "style=" Float:none; "title=" screenshot from 2016-07-20 23-50-59.png "alt=" Wkiol1eiiruxfovaaaasobifdu4157.png-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/85/65/wKioL1eiIrzRbZ52AAAUzXKdYYM007.png-wh_500x0-wm_3 -wmp_4-s_2818184769.png "style=" Float:none; "title=" screenshot from 2016-07-20 23-51-11.png "alt=" Wkiol1eiirzrbz52aaauzxkdyym007.png-wh_50 "/>
User Nginx;worker_processes 1;
events { use epoll; worker_connections 1024;} http { upstream westos{ server 172.25.85.4:80; server 172.25.85.5:80; } include mime.types; default_type application/octet-stream;
Location/{root HTML; Index index.html index.htm; } location/status {stub_status on; Access_log off; }
server { listen 443 ssl; server_name server3.example.com; ssl_certificate cert.pem; ssl_certificate_key cert.pem; ssl_ Session_cache shared:ssl:1m; ssl_session_ timeout 5m; ssl_ciphers high:!anull:! md5; ssl_prefer_server_ciphers on; location / { root html; index index.html index.htm; } }
server {Listen 80; server_name www.linux.org; Location/{Proxy_pass Http://westos; }}
server {Listen 80; server_name www.unix.org; Location/{root/web2; Index index.html; }}
Nginx-t
Nginx-s Reload
172.25.85.4 server4.example.com
172.25.85.5 server5.example.com
Install httpd on server4 and Server5, and turn on httpd
echo server4.example.com >/var/www/html/index.html
echo server5.example.com >/var/www/html/index.html
To parse on a physical machine:
172.25.85.3 server3.example.com www.linux.org www.unix.org
Open www.linux.org in the Web page, server4.example.com and server5.example.com alternately appear
LNMP's Nginx