1. Prepare the environment
Yum-y install GCC gcc-C ++ Autoconf automake make
Yum-y install zlib-devel OpenSSL -- devel PCRE-devel
If you do not install the above two items, you may encounter the following problems during my installation:
Download the desired version on this page:
Http://nginx.org/en/download.html
Linux on the left and windows on the right
Run the following command to download the file: wget http://nginx.org/download/nginx-1.7.4.tar.gz
Decompress file: tar-zxvf nginx-1.7.4.tar.gz
Switch Directory: CD nginx-1.7.4
Configuration:./configure
The following message is displayed:./configure: error: the HTTP rewrite module requires the PCRE Library.
You can either disable the module by using -- without-http_rewrite_module
Option, or install the PCRE Library into the system, or build the PCRE Library
Statically from the source with nginx by using -- With-PCRE = <path> option.
You need to install PCRE to enable ngnix to support rewrite.
Install: Yum install pcre-devel.i686 with command
Enter y and press Enter.
The last prompt is complete, indicating that the installation is successful:
Run./configure again.
The same error is returned;
Run the command to find the installation location of PCRE: file-name PCRE
The result is:./auto/lib/PCRE.
Add a parameter to specify the path
Run the command:./configure -- With-PCRE =./auto/lib/PCRE
The following message is displayed:
./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.
Zlib library information is missing!
Run the following command to install Yum-y install make zlib-devel gcc-C ++ libtool:
After the installation is successful, run:./configure -- With-PCRE =./auto/lib/PCRE
The last prompt is as follows:
If the configuration is successful, run the following command to install it:
Make & make install
The following error message is displayed:
If the installation is complete, the installation still fails. Finally, run the following command to solve the problem:
Yum-y install zlib-devel OpenSSL -- devel PCRE-devel
Run:./configure
Run make & make install again.
Installation complete!
Remember some directory locations!
Modify the configuration file:
Switch Directory: CD/usr/local/nginx/Conf
Modify the file: VI nginx. conf
Modify the content of the server configuration section and press the letter I to enter the editing mode.
Press ESC to exit the editing mode. Press the colon key ":" to enter the command mode. Enter "WQ" and press enter to save and exit;
Switch to the sbin Directory: CD/usr/local/nginx/sbin
Start nginx:./nginx
Open the firewall port:
/Sbin/iptables-I input-P TCP -- dport 88-J accept
/Etc/init. d/iptables save
Open your browser and enter the following address to access it:
Http: // your server IP Address: 88/
Have you seen the following information?
I saw it. If you don't see it, keep working!
Nginx1.7.4 installation record under centos6.5