跳转到内容

Nginx安装

在CentOS7下安装并配置

安装手册 1 分钟阅读

在CentOS7下安装并配置 nginx

有以下两种方式

$ sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

创建文件/etc/yum.repos.d/nginx.repo并填写内容

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1

$ yum install -y nginx

$ sudo systemctl start nginx

添加开机启动项

$ sudo systemctl enable nginx

$ sudo systemctl stop nginx

使用nginx命令

# 启动
$ nginx -c /etc/nginx/nginx.conf
# 关闭
$ nginx -s stop

评论