Configure yum to install Nginx under CentOS 6.8

The first step /etc/yum.repos.d/is to create a source configuration file in the directory nginx.repo:

cd /etc/yum.repos.d/

vim nginx.repo

Fill in the following:

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

Save, a /etc/yum.repos.d/nginx.repofile will be generated.

Next, execute the following command directly to automatically install Nginx:

yum install nginx -y

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

service nginx start

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

If you still can't access, 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

Nginx command and configuration file location:

service nginx start # Start the Nginx service
service nginx stop # Stop Nginx service
service nginx.conf # Nginx configuration file location

So far, Nginx has been fully configured and installed.

For more Nginx related tutorials, see the following :

CentOS 6.2 actual deployment of Nginx+MySQL+PHP  http://www.linuxidc.com/Linux/2013-09/90020.htm

Use Nginx to build a WEB serverhttp  ://www.linuxidc.com/Linux/2013-09/89768.htm

The whole process of building a web server based on Linux6.3+Nginx1.2+PHP5+MySQL5.5http:  //www.linuxidc.com/Linux/2013-09/89692.htm

Nginx performance tuning under CentOS 6.3http  : //www.linuxidc.com/Linux/2013-09/89656.htm

Configure Nginx to load ngx_pagespeed module under CentOS 6.3http  : //www.linuxidc.com/Linux/2013-09/89657.htm

CentOS 6.4 installation and configuration Nginx+Pcre+php-fpm  http://www.linuxidc.com/Linux/2013-08/88984.htm

Detailed notes on Nginx installation and configuration  http://www.linuxidc.com/Linux/2014-07/104499.htm

Nginx log filtering uses ngx_log_if not to log specific logs  http://www.linuxidc.com/Linux/2014-07/104686.htm

 

 

 

 

operating system

[root@10-10-106-30 ~]# cat /etc/redhat-release
CentOS release 6.6 (Final)

yum install nginx

yum install nginx -y

安装完成

[root@10-10-106-30 ~]# nginx -v
nginx version: nginx/1.0.15

防火墙配置

iptables -I INPUT -p tcp --dport 80 -j ACCEPT

运行/etc/init.d/iptables status 如果有这一条  1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80  说明防火墙配置成功  启动nginx  /etc/init.d/nginx start

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326228763&siteId=291194637