1024programmer Nginx CentOS6.3 system installation and configuration Nginx

CentOS6.3 system installation and configuration Nginx

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
[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

#Query nginx main process number
ps -ef | grep nginx
#stop process
kill -QUIT main process ID
#quickstop
kill -TERM main 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
#Test in browser
http://ip:80

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/centos6-3-system-installation-and-configuration-nginx/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索