Centos下yum 安装nginx
By:Roy.LiuLast updated:2020-11-02
网上很多文档时编译源码安装nginx, 但NGINX官方是提供了yum安装源的,参考官方文档: http://nginx.org/en/linux_packages.html#RHEL-CentOS。
sudo yum install yum-utils
创建文件:/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
安装
sudo yum install nginx
启动并设置自动启动
systemctl start nginx.service systemctl enable nginx.service
安装完毕后,配置文件在 /etc/nginx 目录下, 自行修改.
From:一号门
Previous:给博客添加一个摇头晃脑的萌妹子的JS代码
COMMENTS