Nginx relies on software libraries to ensure that the system installs GCC, SSL, pcre, and Gzip software prior to installation, and can use the RPM-Q command to see if the software is installed.
[Root@redhat1 ~]# rpm-q gcc
Gcc-4.1.2-44.el5
The dependent library information is as follows:
(1). The gzip module requires a zlib library (download: http://www.zlib.net/)
(2). Rewrite module requires pcre library (download: http://www.pcre.org/)
(3). SSL functionality requires OpenSSL library (download: http://www.openssl.org/)
If you install Pcre, download pcre to the destination directory, the version selected here is pcre-8.38, after downloading, perform the following actions
TAR-ZXVF pcre-8.38.tar.gz
cd pcre-8.38
./configure make make
install
Install Nginx, and execute the following command
By default, a compiled installation of Nginx already contains most of the available modules, and you can use the "./configure--help" option to set the usage of each module, such as for unwanted http_ssi modules, through "--without-http_ssi_ Module parameter closes this module, and if the "Http_perl" module is required, you can install it through the "--with-http_perl_module" parameter. Perform the following actions to install.
TAR-ZXVF nginx-1.11.1.tar.gz
cd nginx-1.11.1
./configure--with-pcre=. /pcre-8.38--prefix=/usr/local/nginx make make
install
Detect if the installation was successful, execute the following command
[Root@redhat1 sbin]# Cd/usr/local/nginx/sbin
[Root@redhat1 sbin]#./nginx-t
The following information appears to prove that the installation was successful
Nginx:the configuration file/usr/local/nginx/conf/nginx.conf syntax is OK
Nginx:configuration file/usr/local/nginx/conf/nginx.conf Test is successful
Start Nginx
[Root@redhat1 sbin]#./nginx
View ports
[Root@redhat1 sbin]# NETSTAT-NTLP
The results are as follows:
Proto recv-q Send-q Local address Foreign address State Pid/program Name
TCP 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 2993/hpiod
TCP 0 0 0.0.0.0:834 0.0.0.0:* LISTEN 2772/rpc.statd
TCP 0 0 0.0.0.0:11111 0.0.0.0:* LISTEN 3391/ricci
TCP 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2733/portmap
TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3852/nginx
TCP 0 0 0.0.0.0:16851 0.0.0.0:* LISTEN 3290/modclusterd
TCP 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3024/cupsd
TCP 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3057/sendmail:acce
TCP 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN 2998/python
TCP 0 0:: £ º::* LISTEN 3013/sshd
You can also enter in the browser: http://localhost to verify that the startup is successful.
Stop Nginx
The stop operation is done by sending a signal to the nginx process.
Step 1: Query Nginx main process number:
Ps-ef | grep nginx
In the process list, look for the master process, which is numbered as the main process number.
Step 2: Send a signal
Calmly stop nginx:kill-quit the main process number
Quick Stop Nginx:kill-term The main process number
Force Stop nginx:pkill-9 Nginx
Reboot nginx: Smooth reboot
If you change the configuration, restart the Nginx, turn off Nginx before you open it? No, you can send a signal to the nginx, smooth reboot.
Smooth Restart command:
Kill-hup live in the title or process number file path or/usr/local/nginx/sbin/nginx-s reload
Note that after modifying the configuration file, it is best to check that the modified profile is correct so that the Nginx error affects the stable operation of the server after the reboot. Sentenced
The Nginx configuration is correctly ordered as follows:
Nginx-t-c/usr/local/nginx/conf/nginx.conf or/usr/local/nginx/sbin/nginx-t.
Thank you for reading, I hope to help you, thank you for your support for this site!