Install Nginx on CentOS

Source: Internet
Author: User
: This article describes how to install Nginx on CentOS. if you are interested in the PHP Tutorial, refer to it. Turn: http://my.oschina.net/VincentJiang/blog/224993

CENTOS 6.5 configure YUM to install NGINX

Step 1:/etc/yum.repos.d/Create a source configuration file under the Directorynginx.repo:

cd /etc/yum.repos.d/ vim nginx.repo

Enter the following content:

[nginx]name=nginx repobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=0enabled=1

(Note: The nginx. repo file is used to download the corresponding system version when installing nginx using yum. I used CentOS, so I wrote/centos/in the baseurl /)

Save, /etc/yum.repos.d/nginx.repoFile.

Run the following command to automatically install Nginx:

yum install nginx -y

After the installation is complete, you can start Nginx directly:

/etc/init.d/nginx start

Now that Nginx has been started, you can directly access the server to see the Nginx welcome page.

If the access is unavailable, configure the Linux firewall.

iptables -I INPUT 5 -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT service iptables save service iptables restart

Nginx command and configuration file location:


/Etc/init. d/nginx start # start Nginx service/etc/init. d/nginx stop # stop Nginx service/etc/nginx. conf # Nginx configuration file location

So far, Nginx has been fully configured and installed.



The above introduces how to install Nginx in CentOS, including some content. I hope my friends who are interested in the PHP Tutorial can help me.

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.