Installation instructions
System Environment: CentOS-6.3
Software: nginx-1.2.6.tar.gz
Installation Method: source code compilation and Installation
Installation path:/usr/local/nginx
: Http://nginx.org/en/download.html
Prerequisites
Before installing nginx, make sure that the system has installed g ++, gcc, openssl-devel, pcre-devel, and zlib-devel. Install required software:
[Root @ admin/] # yum install gcc-c ++ Yum-y install zlib-devel openssl -- devel pcre-devel |
Check the Nginx installed by the system:
[Root @ admin local] # find-name nginx ./Nginx ./Nginx/sbin/nginx ./Nginx-1.2.6/objs/nginx |
Uninstall the original Nginx
| [Root @ admin/] # yum remove nginx |
Install
Upload the installation package file to/usr/local and perform the following operations:
[Root @ admin local] # cd/usr/local [Root @ admin local] # tar-zxv-f nginx-1.2.6.tar.gz [Root @ admin local] # rm-rf nginx-1.2.6.tar.gz [Root @ admin local] # Music nginx-1.2.6 nginx [Root @ admin local] # cd/usr/local/nginx [Root @ admin nginx] #./configure -- prefix =/usr/local/nginx [Root @ admin nginx] # make [Root @ admin nginx] # make install |
Configuration
# Modify the Firewall Configuration: [Root @ admin nginx-1.2.6] # vi +/etc/sysconfig/iptables # Add configuration items -A input-m state -- state NEW-m tcp-p tcp -- dport 80-j ACCEPT # Restarting the Firewall [Root @ admin nginx-1.2.6] # service iptables restart |
Start
# Method 1 [Root @ admin nginx-1.2.6] #/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx. conf # Method 2 [Root @ admin nginx-1.2.6] # cd/usr/local/nginx/sbin [Root @ admin 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
[Root @ admin local] #/usr/local/nginx/sbin/nginx-s reload |
Test
# Test Port Netstat-na | grep 80 # Testing in the browser Http: // ip: 80 |