1. System Prepare
Install the CentOS6.7 system on the virtual machine , set up IP and DNS for the system so that the system can be networked, and then prepare for the environment.
2. Environmental preparedness
Install the relevant compilation environment and dependencies
yum-y Install gcc gcc-c++ autoconf automake make
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7F/CE/wKiom1ctltvjNeO3AAB4WElDKX4229.png "title=" QQ picture 20160507152756.png "alt=" Wkiom1ctltvjneo3aab4weldkx4229.png "/>
Yum-y install zlib zlib-devel OpenSSL openssl--devel pcre pcre-devel
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7F/CC/wKioL1ctmVvwE5OsAACkCoja1xc994.png "style=" float: none; "title=" 2.png "alt=" Wkiol1ctmvvwe5osaackcoja1xc994.png "/>
can go to this page to download the version you want, the latest version of nginx-1.10.0, this article is using nginx-1.7.4
Http://nginx.org/en/download.html
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/CE/wKiom1ctmILDPMULAABXvCCeTDc879.png "title=" 3.png " Style= "Float:none;" alt= "Wkiom1ctmildpmulaabxvccetdc879.png"/>
download the file using the following command: wget http://nginx.org/download/nginx-1.7.4.tar.gz
upload the downloaded nginx to the/opt/nginx directory. Run "TAR-ZXVF nginx-1.7.4.tar.gz" to decompress.
Configuration: ./configure
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7F/CC/wKioL1ctn2OTp8MrAACLHb081XM758.png "title=" 1 " Style= "Float:none;" alt= "Wkiol1ctn2otp8mraaclhb081xm758.png"/>
If not installed pcre related, will produce the following error
650) this.width=650; "src=" http://www.linuxidc.com/upload/2015_03/15031418518380.jpg "alt=" 15031418518380.jpg "/ >
Similarly, no zlib will produce relevant error
./configure:error:the HTTP gzip module requires the Zlib library.
You can either disable the module by using--without-http_gzip_module
option, or install the Zlib library into the system, or build the Zlib library
Statically from the source with Nginx by using--with-zlib=<path> option.
If the same error is indicated;
Execute command Find pcre installation location: File-name pcre
What you get is:./auto/lib/pcre
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7F/CC/wKioL1ctn2OT9dOXAAAcxWltgGA096.png "title=" 2 " Style= "Float:none;" alt= "Wkiol1ctn2ot9doxaaacxwltgga096.png"/>
Follow the prompts to add parameters to specify path
Execute command:./configure--with-pcre=./auto/lib/pcre
If you see the above image, indicating that the configuration was successful, perform the following command installation:
Make && make install
The following error is prompted:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/CE/wKiom1ctnoqg2FNtAABJACpXV_s534.png "title=" 3 " Style= "Float:none;" alt= "Wkiom1ctnoqg2fntaabjacpxv_s534.png"/>
Re-execution :./configure
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/CC/wKioL1ctn2STa1-EAABz_YRpTQE875.png "title=" 4 " Style= "Float:none;" alt= "Wkiol1ctn2sta1-eaabz_yrptqe875.png"/>
Re-execute: Make&& make install
Installation is complete!
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/CE/wKiom1ctnouQ8MjUAACeGTFFtN8028.png "title=" 5 " Style= "Float:none;" alt= "Wkiom1ctnouq8mjuaacegtfftn8028.png"/>
To modify a configuration file:
Switch directory:cd/usr/local/nginx/conf
Modified file:VI nginx.conf
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7F/CE/wKiom1ctoJfweIkaAAAUGeUR9EA243.png "title=" 11.png "Style=" Float:none; "alt=" Wkiom1ctojfweikaaaaugeur9ea243.png "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7F/CE/wKiom1ctoS-jJdJmAABy-l5PU6o611.png "style=" float: none; "title=" 14.png "alt=" Wkiom1ctos-jjdjmaaby-l5pu6o611.png "/>
Switch to sbin directory:cd/usr/local/nginx/sbin
Start Nginx:./nginx
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7F/CE/wKiom1ctoS-BB4VZAAAc8f0FLZo058.png "title=" 13.png "Style=" Float:none; "alt=" Wkiom1ctos-bb4vzaaac8f0flzo058.png "/>
Open the browser and enter the following address to access it:
HTTP//Your server IP
Do you see the following information?
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7F/CC/wKioL1ctoXGiGlUDAABAGUsDGKo177.png "style=" float: none; "title=" 12.png "alt=" Wkiol1ctoxgigludaabagusdgko177.png "/>
Configure Nginx boot ,vi/etc/rc.d/rc.local
Add "/usr/local/nginx/sbin/nginx" to the end of the file
Nginx Common commands:
Reload configuration file:/usr/local/nginx/sbin/nginx-s Reload
Stop Nginx service:/usr/local/nginx/sbin/nginx-s stop
This article is from the "Seet" blog, make sure to keep this source http://6649329.blog.51cto.com/6639329/1771022
Installing Nginx under CentOS