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/
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有