Install Nginx on CentOS

WBOY
Release: 2016-08-08 09:20:06
Original
1038 people have browsed it

Redirected to: http://my.oschina.net/VincentJiang/blog/224993

CENTOS 6.5 Configure YUM to install NGINX

The first step is in <spanmicrosoft yahei font-size:14px>/etc/yum.repos.d/</spanmicrosoft> Create a source configuration file <spanmicrosoft yahei font-size:14px>nginx.repo</spanmicrosoft> in the directory:

cd /etc/yum.repos.d/
 
vim nginx.repo
Copy after login
Fill in the following content:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
Copy after login

(Note: ngin The x.repo file is for When using yum to install nginx, you can download the corresponding system version. I am using CentOS, so write /centos/) in the baseurl

and save it, a <spanmicrosoft yahei font-size:14px> will be generated. /etc/yum.repos.d/nginx.repo</spanmicrosoft> file. Just execute the following command to automatically install Nginx:

yum install nginx -y
Copy after login

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

/etc/init.d/nginx start
Copy after login

Now Nginx has After it is started, you can see the Nginx welcome page by directly accessing the server. If you still cannot access it, you need to 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
Copy after login

Nginx command and configuration file location:


/etc/init.d/nginx start # 启动Nginx服务
 
/etc/init.d/nginx stop # 停止Nginx服务
 
/etc/nginx/nginx.conf # Nginx配置文件位置
Copy after login

At this point, Nginx has been fully configured and installed.

The above introduces the installation of Nginx on CentOS, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template