centos6.3 Installing Nginx

Source: Internet
Author: User

The general use of Linux system of many netizens may be directly using a key installation package for installation, the previous author also this way, but many times these one-button installation is convenient but may be in the upgrade and many other places is not very good, this article on the centos6.3 installation nginx1.2 steps.

Installation Instructions

Operating system: centos6.3

Software: nginx-1.2.6.tar.gz

Installation method: Source code Installation

Installation Location:/usr/local/nginx

Nginx:http://nginx.org/en/download.html

Preparation Tools

In installing the Nginx shirt, you need to ensure that the system has g++, GCC, Openssl-devel, Pcre-devel, and Zlib-devel software installed.

    1. Yum Install gcc-c++
    2. Yum-y install zlib zlib-devel OpenSSL openssl--devel pcre pcre-devel

Check the ningx of the system installation

    1. Find-name Nginx
    2. ./nginx
    3. ./nginx/sbin/nginx
    4. ./nginx-1.2.6/objs/nginx

Uninstall the original Nginx system

    1. Yum Remove Nginx
CentOS installation Nginx

Upload the installation package file to the directory, this article is uploaded to/usr/local, follow the command below.

    1. [Email protected] local]# cd/usr/local
    2. [Email protected] local]# tar-zxv-f nginx-1.2.6.tar.gz
    3. [Email protected] local]# RM-RF nginx-1.2.6.tar.gz
    4. [Email protected] local]# MV nginx-1.2.6 Nginx
    5. [Email protected] local]# Cd/usr/local/nginx
    6. [Email protected] nginx]#/configure --prefix=/usr/local/nginx
    7. [[email protected] nginx]# make
    8. [[email protected] nginx]# make install
Configuring firewalls

Configure the firewall to open 80 port, do not open, sometimes the firewall will not let the extranet access to 80 port we will not be able to access the Nginx configuration site.

    1. #修改防火墙配置:
    2. [Email protected] nginx-1.2.6]# VI +/etc/sysconfig/iptables
    3. #添加配置项
    4. -A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
    5. #重启防火墙
    6. [Email protected] nginx-1.2.6]# service iptables restart
Enable Nginx command
    1. #方法1
    2. [Email protected] nginx-1.2.6]#/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
    3. #方法2
    4. [Email protected] nginx-1.2.6]# Cd/usr/local/nginx/sbin
    5. [Email protected] sbin]#./nginx
Stop Nginx Command
    1. #查询nginx主进程号
    2. Ps-ef | grep nginx
    3. #停止进程
    4. Kill-quit Main process Number
    5. #快速停止
    6. Kill-term Main process Number
    7. #强制停止
    8. Pkill-9 Nginx
Restart Nginx command
    1. [Email protected] local]#/usr/local/nginx/sbin/nginx-s Reload

centos6.3 Installing Nginx

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.