1.操作系统信息查看
cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
7.6.1810满足安装条件
2.创建repo文件
vi /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
3.下载并导入key
wget http://nginx.org/keys/nginx_signing.key
sudo rpm --import nginx_signing.key
4.安装
yum install nginx
nginx -version
nginx version: nginx/1.14.2
5.常用命令
命令 | 描述 |
---|---|
rpm -ql nginx | grep service | 查看nginx服务 |
systemctl start nginx | 启动 |
systemctl stop nginx | 快速停止或关闭 |
systemctl restart nginx | 重新启动 |
systemctl reload nginx | 配置文件修改重装载 |
systemctl status nginx | 查看状态 |
6.配置文件
/etc/nginx/nginx.conf
网友评论