CentOS 中安装 Nginx 使用yum

仓库

为了可以使用 CentOS 系统的包管理工具去安装更多的东西,我们需要单独安装一些额外的软件仓库。

EPEL

sudo yum install epel-release -y

IUS

sudo yum install https://centos7.iuscommunity.org/ius-release.rpm -y

IUS 仓库里面有我们需要的一些新的软件包,比如 PHP 7。注意我们安装的是为 CentOS  7 这个系统准备的 IUS 仓库,如果你的系统是 CentOS 6,你需要到 IUS 网站上去查找适合的仓库的下载地址。

安装 NGINX

NGINX 这个软件包已经包装在 EPEL 仓库里了,之前我们已经安装了这个仓库,所以可以直接使用包管理工具去安装 NGINX。

sudo yum install nginx -y

启动

sudo systemctl start nginx

开启自启动

sudo systemctl enable nginx

 

服务启动以后,你就可以在浏览器上使用服务器的 IP 地址,或者指向这个地址的域名访问服务器指定的目录了。你会看到类似下面的这些文字。

Welcome to nginx! If you see this page, the nginx web server is successfully installed and working. Further configuration is required. For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com. Thank you for using nginx.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值