Install Nginx under CentOS

Source: Internet
Author: User

1. Installation Instructions
System Environment: CentOS-6.3
Software: nginx-1.9.0.tar.gz
Installation method: Source code compiled and installed
Installation Location:/usr/local/src/nginx_1.9.0
: http://nginx.org/en/download.html

2. Installation Prerequisites
Before installing Nginx, you need to ensure that the system has g++, GCC, Openssl-devel, Pcre-devel, and Zlib-devel software installed. Installation must be software:
The installation commands are as follows:
[Root@localhost/]# Yum Install gcc-c++
[root@localhost/]# yum-y install zlib zlib-devel OpenSSL openssl–devel pcre pcre-devel

Check the system installation Nginx:
[Root@localhost/]# find-name Nginx
./usr/local/src/nginx_1.9.0/sbin/nginx

To uninstall the original nginx:
[Root@localhost/]# Yum Remove Nginx

3. Installation
Upload the installation package file to/usr/local/src/to do the following:
[Root@localhost/]# CD/USR/LOCAL/SRC
[Root@localhost src]# TAR-ZXVF nginx-1.9.0.tar.gz
[Root@localhost src]# RM-RF nginx-1.2.6.tar.gz
[Root@localhost src]# cd/usr/local/src/nginx-1.9.0
[Root@localhost nginx_1.9.0]#./configure–prefix=/usr/local/nginx_1.9.0
[Root@localhost nginx_1.9.0]# make && make install

4. Configuration
Go to modify firewall configuration:
[Root@localhost nginx_1.9.0]# Vi/etc/sysconfig/iptables
To add a configuration entry:
-A input-m state–state new-m tcp-p tcp–dport 80-j ACCEPT
To restart the firewall:
[root@localhost nginx_1.9.0]# Service iptables restart

5. Start Nginx
[Root@localhost nginx_1.9.0]# Cd/usr/local/src/nginx_1.9.0/sbin
[Root@localhost sbin]#./nginx

6. The test is successful
Enter test address in browser: http://ip:80

Install Nginx under CentOS

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.