Before installing nginx, make sure that the system has installed G ++, GCC, OpenSSL-devel, PCRE-devel, and zlib-devel. Install required software:
[[Email protected]/] # Yum install gcc-C ++
Yum-y install zlib-devel OpenSSL -- devel PCRE-devel |
Check the nginx installed by the system:
| [[Email protected] local] # Find-name nginx |
Uninstall the original nginx
| [[Email protected]/] # Yum remove nginx |
Install
Upload the installation package file to/usr/local and perform the following operations:
[[Email protected] SRC] # tar-zxv-F nginx-1.6.2.tar.gz
[[Email protected] nginx-1.6.2] #./configure
[[Email protected] nginx-1.6.2] # Make
[[Email protected] nginx-1.6.2] # make install |
Configuration
# Modify the Firewall Configuration:
[[Email protected] nginx-1.6.2] # vi +/etc/sysconfig/iptables
# Add configuration items
-A input-M state -- state new-m tcp-p tcp -- dport 80-J accept
# Restarting the Firewall
[[Email protected] nginx-1.6.2] # service iptables restart |
Start
# Method 1
[[Email protected] nginx-1.6.2] #/usr/local/nginx/sbin/nginx-C/usr/local/nginx/CONF/nginx. conf
# Method 2
[[Email protected] nginx-1.2.6] # cd/usr/local/nginx/sbin
[[Email protected] sbin] #./nginx |
Stop
# Querying the nginx master process number
PS-Ef | grep nginx
# Stop a process
Kill-Quit master process number
# Quick Stop
Kill-term master process number
# Force stop
Pkill-9 nginx |
Restart
| [[Email protected] local] #/usr/local/nginx/sbin/nginx-s reload |
Test
# Test Port
Netstat-Na | grep 80
# Testing in the browser
Http: // ip: 80 |
Configure nginx for CentOS-6.4 Installation