Installation Instructions
System environment: CentOS-6.3
Software: nginx-1.2.6.tar.gz
Installation method: source code compilation and installation
Installation location: /usr/local/nginx
Download address: 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 software. Install necessary software:
[root@admin /]#yum install gcc-c++ yum -y install zlib zlib-devel openssl openssl –devel pcre pcre-devel |
Check the system installed Nginx:
[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]# mv 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 firewall configuration: [root@admin nginx-1.2.6]# vi + /etc/sysconfig/iptables #Add configuration item -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT #restart firewall [root@admin nginx-1.2.6]# service iptables restart
|
Start
#Method 1
|
Stop
#Query nginx main process number |
Restart
[root@admin local]# /usr/local/nginx/sbin/nginx -s reload |
Test
#test port |