Prior to using Nginx on Windows system, today try to install Nginx under Linux (CentOS7.2) success. Record it.
Nginx's Download
Nginx Bag: http://nginx.org/download/nginx-1.8.0.tar.gz
Nginx Dependency Package (to download the corresponding website):
1.gzip module requires zlib library (download http://zlib.net/zlib-1.2.8.tar.gz in http://www.zlib.net/)
2.rewrite module requires pcre library (download ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/in http://www.pcre.org/)
3.ssl function requires OpenSSL library (download http://www.openssl.org/source/openssl-fips-2.0.9.tar.gz in http://www.openssl.org/)
Prerequisites for Installation:
Need to install the Gcc:yum install gcc-c++
First install the necessary library (Nginx in the gzip module need zlib library, rewrite module needs pcre library, SSL function requires OpenSSL library). Select /usr/local as the installation directory, copy the four jar packages to /usr/localin advance, and the following specific version numbers are changed according to the actual changes.
1. Installing the Pcre Library
$ cd /usr/local/$ tar -zxvf pcre-8.36.tar.gz$ cd pcre-8.36$ ./configure$ make$ make install
2. Installing the Zlib Library
$ cd /usr/local/ $ tar -zxvf zlib-1.2.8.tar.gz$ cd zlib-1.2.8$ ./configure$ make$ make install
3. Install SSL
$ cd /usr/local/$ tar -zxvf openssl-1.0.1j.tar.gz$ ./config$ make$ make install
4. Installing Nginx
$ cd /usr/local/$ tar -zxvf nginx-1.8.0.tar.gz$ cd nginx-1.8.0
--with-pcre= /usr/local
/pcre-8.37 --with-zlib=/zlib-1.2.8-- /usr/local
With-openssl=/usr/local/openssl-fips-2.0.9 --
$ make install
5. Start
$ /usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
will appear:
Check whether the startup was successful:
Open the browser to access the IP of this machine if the browser appears Welcome to nginx! Indicates that Nginx is installed and running successfully.
Some commands are as follows:
Restart:
$/usr/local/nginx/sbin/nginx–s Reload
Stop it:
$/usr/local/nginx/sbin/nginx–s Stop
Test the configuration file for normal:
$/usr/local/nginx/sbin/nginx–t
Forced shutdown:
$ pkill Nginx
Installing Nginx under Linux