CentOS 7 下安装 Nginx

一、通过 yum 方式安装

安装 nginx 源

在官网下载对应系统的 rpm 文件安装。

shell> wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
shell> yum localinstall nginx-release-centos-7-0.el7.ngx.noarch.rpm

安装并启动 Nginx

安装 nginx,查看版本号信息

shell> yum install nginx
shell> nginx -v

启动 nginx 服务,用 curl 命令访问一次查看是否启动成功

shell> systemctl start nginx
shell> curl localhost

设置开机启动

shell> systemctl enable nginx
# 重载所有修改过的配置文件
shell> systemctl daemon-reload

二、源码安装

待更新

你可能感兴趣的:(CentOS 7 下安装 Nginx)