Https://www.cnblogs.com/wyd168/p/6636529.html
Before you begin, verify that the GCC g++ Development class Library is installed, and that the default is set.
The UBUBTU platform compilation environment can use the following directives
apt-get install build-essentialapt-get install libtool
The CentOS Platform compilation environment uses the following directives
Install Make:
Yum-y install gcc automake autoconf libtool make
Install g++:
Yum Install gcc gcc-c++
The following official start:
One, select the installation file directory
Can select any directory, this article select CD/USR/LOCAL/SRC
Second, install Pcre Library
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Download the latest Pcre source package and download the compilation and installation using the command below Pcre Package: (This article refers to the download file version: Pcre-8.37.tar.gz verified that this version is not found, if you want to download the latest version please open the above URL. This article selects pcre-8.39.tar.gz)
cd/usr/local/srcwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz TAR-ZXVF pcre-8.37. TAR.GZCD pcre-8.34./configuremakemake install
Third, install zlib library
http://zlib.net/zlib-1.2.11.tar.gz Download the latest zlib source package, download the compile and install the zlib package using the command below: (This article refers to the download file version: Zlib-1.2.8.tar.gz verified that this version is not found, To download the latest version, please open the above URL. This article selects zlib-1.2.11.tar.gz)
cd/usr/local/src wget http://ZLIB.NET/ZLIB-1.2.11.TAR.GZTAR-ZXVF zlib-1.2. tar.gzcd zlib-1.2.11./configuremakemake install
iv. Installing OpenSSL (some VPS does not install SSL by default)
cd/usr/local/srcwget https://WWW.OPENSSL.ORG/SOURCE/OPENSSL-1.0.1T.TAR.GZTAR-ZXVF openssl- 1.0.1t.tar.gz
Five, install Nginx
Nginx generally has two versions, the stable version and the development version, you can choose one of these two versions according to your purpose, below is the detailed steps of installing nginx into the/usr/local/nginx directory:
cd/usr/local/srcwget http://NGINX.ORG/DOWNLOAD/NGINX-1.1.10.TAR.GZTAR-ZXVF nginx-1.1. Ten. TAR.GZCD nginx-1.1. 10
. /Configure
Make
Make install
Note: errors may occur here
Follow the fourth step method or
Under Ubuntu
apt-get install opensslapt-get install Libssl-dev
Under CentOS
Yum-y Install OpenSSL Openssl-devel
Six, start Nginx
Since the Apeache may occupy 80 ports, the Apeache port should not be modified as far as possible, we choose to modify the Nginx port.
Linux Modify path/usr/local/nginx/conf/nginx.conf,windows under install directory \conf\nginx.conf.
Modify the port to 8090,localhost for your server IP address. (Success is in sight!!) )
Start Nginx
80
If no results are found, ignore the previous step (you must start with sudo under Ubuntu, or you can only run in the foreground)
Sudo/usr/local/nginx/nginx
Seven, Nginx Restart, shutdown, startStart
Startup code format: Nginx installation directory address-C nginx configuration file address
For example:
/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
Stop
There are three ways to stop Nginx:
1. View process number
[Email protected] ~]# Ps-ef|grep Nginx
2. Kill the Process
[Email protected] ~]# kill-quit 2072
1. View process number
[Email protected] ~]# Ps-ef|grep Nginx
2. Kill the Process
[Email protected] ~]# kill-term 2132
or [[email protected] ~]# Kill-int 2132
[Email protected] ~]# pkill-9 Nginx
Restart1, verify the Nginx configuration file is correctmethod One: Go to the Nginx installation directory sbin, enter the command./NGINX-T
See shown below nginx.conf syntax is OK
Nginx.conf Test is successful
Description The configuration file is correct!
method Two: add-t before the start command-C
2. Restart Nginx servicemethod One: Go to the Nginx executable directory sbin, enter the command
./nginx-s Reload
method Two: Find the current nginx process number, and then enter the command: KILL-HUP process number Implementation Restart Nginx service
viii. Final result :
Nine, the project file storage path
Put it under this file and create a folder to put it in.
Reference article: Http://www.nginx.cn/install
Installation of nginx steps in Linux environment