Centos 安装nginx 的最新稳定版本的最简单方法

当然是官方的指导方法,以下方法来自
http://nginx.org/en/linux_packages.html#RHEL-CentOS
主要内容搬家如下:

首先安装:

yum install yum-utils

然后建立repository, 内容如下

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

拷贝如下内容:

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

上面是默认方式安装稳定版本,如果想安装主线版本,运行如下命令:

yum-config-manager --enable nginx-mainline

安装 nginx , 运行如下命令

yum install nginx

等一会儿,到

/usr/sbin

运行:

./nginx

检查一下:

ps -ef|grep nginx

得到:

root      66791      1  0 09:42 ?        00:00:00 nginx: master process ./nginx
nginx     66792  66791  0 09:42 ?        00:00:00 nginx: worker process
nginx     66793  66791  0 09:42 ?        00:00:00 nginx: worker process
nginx     66794  66791  0 09:42 ?        00:00:00 nginx: worker process
nginx     66795  66791  0 09:42 ?        00:00:00 nginx: worker process
nginx     66796  66791  0 09:42 ?        00:00:00 nginx: worker process
nginx     66797  66791  0 09:42 ?        00:00:00 nginx: worker process
nginx     66798  66791  0 09:42 ?        00:00:00 nginx: worker process
nginx     66799  66791  0 09:42 ?        00:00:00 nginx: worker process
nginx     66800  66791  0 09:42 ?        00:00:00 nginx: worker process
nginx     66801  66791  0 09:42 ?        00:00:00 nginx: worker process
nginx     66802  66791  0 09:42 ?        00:00:00 nginx: worker process
nginx     66803  66791  0 09:42 ?        00:00:00 nginx: worker process

说明安装成功。

是记
MaraSun BJFWDQ

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值