First step: Install Nginx's dependent environment first
1, installation pcre-devel yum-y install Pcre-devel #支持正则的pcre模块 such as installation or manual installation will be error
2. Installing OpenSSL yum-y install OpenSSL openssl-devel
Step Two: Install Nginx
1. Download the corresponding version from http://nginx.org/ (or wget http://nginx.org/download/nginx-1.9.4.tar.gz Download directly on Linux with commands) use the latest version of Nginx here.
2, decompression tar-zxvf nginx-1.9.4.tar.gz
3, renamed MV nginx-1.9.4 Nginx, CD nginx into the Nginx directory
4, set the configuration information./configure--prefix=/usr/nginx Specifies the installation path.
Here's a note: if you're a./configure without a path, Nginx installs the default path to its internal settings, which you can use./configure--help view, as shown in (part), Red 1 is the Nginx system is automatically installed by default, Red 2 and vice versa , if you need to install a module, you can use the command:
./configure--prefix=/usr/local/nginx--with-http_ssl_module--with-http_gzip_static_module--with-http_stub_ Status_module
Then use
Install the Make && makes install command
Start Action
Cd/usr/local/nginx/sbin then executes the./nginx command to start the service.
Stop Operation
the stop operation is done by sending a signal to the nginx process.
Step 1: Query the Nginx main process number
ps-ef | grep nginx
find the master process in the list of processes, whose number is the main process number.
Step 2: Send a signal
calmly stop nginx:
kill-quit main process number
Quick Stop Nginx:
kill-term main process number
Force stop Nginx:
pkill-9 Nginx
In addition, if the nginx.conf configuration of the PID file storage path, the file is stored in the Nginx main process number, if not specified in the Nginx logs directory. With the PID file, we do not have to query the Nginx main process number, and directly to the nginx sent a signal, the command is as follows:
kill-Signal type '/usr/nginx/logs/nginx.pid '
Smooth Restart
If you change the configuration to restart Nginx, you need to turn off the nginx before opening? No, can send a signal to nginx, smooth restart.
Smooth restart command:
Kill-hup live in title or process number file path
or use
/usr/nginx/sbin/nginx-s Reload
Note that after modifying the configuration file, it is best to check the correct configuration file, so as not to restart after the Nginx error affecting the stable operation of the server. Determine if the Nginx configuration is the correct command as follows:
nginx-t-c/usr/nginx/conf/nginx.conf
or
/usr/nginx/sbin/nginx-t
The above information is from the network collation.
Manually installing the nginx1.9.x version under CentOS 6.5