Before installing Nginx, first install the compilation environment GCC and g++, and then use CentOS as an example to install Nginx, install nginx need Prce Library, zlib Library and SSL support, in addition to SSL outside the other we are to the official website to download:
nginx:http://nginx.org/
pcre:http://www.pcre.org/
zlib:http://www.zlib.net/
First, prepare the package, upload it to the server, and start the installation.
First release the Pcre, and do not install:
tar -xvzf pcre-8.38. tar. gz
Then release zlib:
tar -xvzf zlib-1.2. 8. tar. gz
Installing OpenSSL:
Yum Install OpenSSL openssl-devel
Release Nginx:
tar -xvzf nginx-1.9. 8. tar. gz
Then execute the CD nginx-1.9. 8 Enter the directory to start compiling the installation Nginx:
./configure--sbin-path=/usr/local/nginx/nginx--conf-path=/usr/local/nginx/nginx.conf--pid-path=/usr/local/ Nginx/nginx.pid--with-http_ssl_module--with-pcre=. /pcre-8.38 --with-zlib=. /zlib-1.2. 8 Make Make Install
Attention.. /pcre-8.38 and. /zlib-1.28 is the source directory of the Pcre and Zlib just released, and the compile-time Nginx will be compiled together
A little wait for the compilation installation to complete, the installation location is the beginning of the specified/usr/local/nginx, configuration file location:/usr/local/nginx/nginx.conf
Then determine if the 80 port is not occupied, start the Nginx service:
/usr/local/nginx/nginx
After successful startup, you can see the initial page by using your browser to access the corresponding IP.
Here, the Nginx server is installed successfully.
In addition to the start command, some common nginx commands are as follows:
Check the correctness of the nginx.conf configuration file: /usr/local/nginx/nginx-t
Restart Nginx: /usr/local/nginx/nginx-s Reopen
Stop Nginx: /usr/local/nginx/nginx-s Stop
Reload configuration file: /usr/local/nginx/nginx-s Reload
Installing Nginx server under Linux