I. BACKGROUND
Install LNMP architecture and simple optimization configuration using source package
Second, the experimental environment
rhel6.5
Third, the installation process
1, Nginx (in advance to install the GCC and other compilers)
(1) Download source package http://nginx.org/
(2) tar-zxf nginx-1.8.1.tar.gz
(3) CD nginx-1.8.1
Vim AUTO/CC/GCC
Modify Section 179 Lines (note to us, meaning cancel debug mode)
(4)./configure--prefix=/usr/local/lnmp/nginx \
--with-http_ssl_module \//https Module
--with-http_stub_status_module//nginx Monitoring Module
[Note]: The author encountered two errors in./configure
The first to find the rewrite module (PCRE) is installed with Yum when prompted to install the Pcre, and finally use the Yum install Pcre-devel package to resolve
The second is to find the OpenSSL module, also installs the Openssl-devel package to solve
(5) Make && make install
(6) Modifying environment variables
Go to the current user home directory
Vim. Bash_profile
After the path variable is added:/usr/local/lnmp/nginx/sbin
(7) Nginx (start service)
(8) Nginx (stop service)
2. Simple optimization and configuration of Nginx
(1) A Ngnix optimized website is recommended here Http://nginx.cn/doc
The optimization can be tailored to the needs of the document on the site
(2) pressure test
Ab-n (total) 1000-c (concurrency) http://172.25.8.63/index.html (This command needs to run on a host that has Apache installed)
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7E/6C/wKiom1b-YLHTDJHcAABjvD3knFs585.png "title=" Picture1.png "alt=" Wkiom1b-ylhtdjhcaabjvd3knfs585.png "/>
(3) Three files that affect the Nginx processing speed (for Nginx itself, system, hardware device, respectively)
1,/usr/local/lnmp/nginx/conf/nginx.conf
Add one line: Worker_rlimit_nofile 65535;
2,/etc/security/limits.conf
Add entry
* Hard Nproc 65535
3. See if/proc/sys/fs/file-max is greater than two parameters (hardware devices should meet the needs of other software and systems)
(4) Add HTTPS
Vim/usr/local/lnmp/nginx/conf/nginx.conf modified to the following fields
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7E/6C/wKiom1b-YlijBRlKAAA82Nh3wDs884.png "title=" Picture2.png "alt=" Wkiom1b-ylijbrlkaaa82nh3wds884.png "/>
(5) Generate CERT.PEM Certificate
Cd/etc/pki/tls/certs
Make Cert.pem
MV Cert.pem/usr/local/lnmp/nginx/conf
Nginx-t
Nginx-s Reload
Access via https://172.25.8.63 when complete
3. Nginx Virtual Host
Configured as follows
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7E/6C/wKiom1b-ZafQVwDfAABcIf1mZoA089.png "title=" Picture4.png "alt=" Wkiom1b-zafqvwdfaabcif1mzoa089.png "/>
4, Nginx reverse proxy
First configure SERVER1 and Server2 install Apache to act as HTTP Realserver
Write to the default publishing page, respectively
echo " >/var/www/html/index.html
echo " >/var/www/html/index.html
Modify the Nginx configuration file as follows
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7E/6D/wKiom1b-ZtTQARwvAAA7Dcc9Sds199.png "style=" float: none; "title=" Picture5.png "alt=" Wkiom1b-zttqarwvaaa7dcc9sds199.png "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7E/69/wKioL1b-Z3mSeVT3AAAry9qhZqk278.png "style=" float: none; "title=" Picture6.png "alt=" Wkiol1b-z3msevt3aaary9qhzqk278.png "/>
Iv. Conclusion
Nginx basic configuration as described above, Nginx is a very powerful Web server, in the future learning also need more detailed understanding of learning. Due to my limited level, there are some mistakes, please point out, thank you.
Compile and install Nginx and simple optimization configuration