Install configuration Web server in CentOS-6.3 system Nginx

Source: Internet
Author: User
Tags openssl centos iptables

Nginx is a high-performance HTTP and reverse proxy server and a IMAP/POP3/SMTP proxy server. The concurrency capabilities of Nginx do perform well in the same type of Web server. Nginx is available in some Linux distributions and in various variants of the BSD version of the installation package, and can be installed with the package management method that comes with each system.

Installation Instructions

System Environment: CentOS-6.3

Software: nginx-1.2.6.tar.gz

Installation Method: source code compilation installation

Installation Location:/usr/local/nginx

Download Address: http://nginx.org/en/download.html

Installation Prerequisites

Before installing Nginx, you need to make sure that the system has g++, GCC, Openssl-devel, Pcre-devel, and Zlib-devel software installed. Installation must be software:

[Root@admin/] #yum install gcc-c++

Yum-y install zlib zlib-devel OpenSSL openssl--devel pcre pcre-devel

Check the nginx of the system installation:

[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

Installation

Upload the installation package file to/usr/local to perform the following actions:

[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

#修改防火墙配置:

[Root@admin nginx-1.2.6]# VI +/etc/sysconfig/iptables

#添加配置项

-A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT

#重启防火墙

[Root@admin nginx-1.2.6]# Service iptables restart

Start

#方法1

[Root@admin nginx-1.2.6]#/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf

#方法2

[Root@admin nginx-1.2.6]# Cd/usr/local/nginx/sbin

[Root@admin sbin]#./nginx

Stop it

#查询nginx主进程号

Ps-ef | grep nginx

#停止进程

Kill-quit Main process Number

#快速停止

Kill-term Main process Number

#强制停止

Pkill-9 Nginx

Reboot

[Root@admin local]#/usr/local/nginx/sbin/nginx-s Reload

Test

#测试端口

Netstat–na|grep 80

#浏览器中测试

Http://ip:80

Configuration Nginx can also be installed on Windows systems.

Related Article

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.