step1:配置本地 yum库,保存
 
$vi   /etc/yum.repos.d/nginx.repo

 
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1
 
其中,"OS"为系统类型,如centos, rhel;"OSRELEASE"为系统发布版本,如“6”,“7”
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1

 
step2:yum安装
$ sudo yum install -y nginx
 
 
step3:启动服务
 
## 启动服务
$ nginx
 
## 关闭nginx服务
$ nginx -s stop
 
step4:部署测试
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
 
## 配置文件路径
$ vi /etc/nginx/nginx.conf
 
或者 
 
$ vi /etc/nginx/init.d/default.conf

 

 

最后访问web路径:

http://test-host/


 

centos6快速搭建nginx

 

相关文章:

  • 2019-02-17
  • 2021-09-04
  • 2022-12-23
  • 2021-09-01
  • 2021-10-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
猜你喜欢
  • 2021-05-25
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
相关资源
相似解决方案