Configure Nginx for CentOS-6.3 Installation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.