第一步:安装EPEL存储库:
[root@localhost nginx-rtmp-module-1.1.11]# yum install epel-release
第二步:安装nginx:
[root@localhost nginx-rtmp-module-1.1.11]# yum install nginx
如果这是您第一次从EPEL存储库安装包装,yum可能会提示您导入EPEL GPG密钥:
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 检索密钥
导入 GPG key 0x352C64E5:
用户ID : "Fedora EPEL (7) <[email protected]>"
指纹 : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
软件包 : epel-release-7-11.noarch (@extras)
来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
第三步:nginx 开机自启动和nginx 服务启动和状态查看
[root@localhost nginx-rtmp-module-1.1.11]# systemctl enable nginx #开机自启动
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@localhost nginx-rtmp-module-1.1.11]# systemctl start nginx #启动nginx服务
[root@localhost nginx-rtmp-module-1.1.11]# systemctl status nginx #查看nginx 状态
第四步:防火墙开放指定服务http 和http
root@localhost nginx-rtmp-module-1.1.11]# firewall-cmd --permanent --zone=public --add-service=http #开启http
success
[root@localhost nginx-rtmp-module-1.1.11]# firewall-cmd --permanent --zone=public --add-service=https #开启https
success
[root@localhost nginx-rtmp-module-1.1.11]# firewall-cmd --reload #防火墙重启
Systemctl 管理nginx 涉及其他指令:
停止Nginx服务=systemctl stop nginx
重新启动Nginx服务=systemctl restart nginx
配置更改后重新加载Nginx服务= systemctl reload nginx
禁用Nginx服务在启动时启动 =systemctl disable nginx
Nginx服务开机自启动= systemctl enable nginx
Nginx 使用yum 安装nginx 相关目录说明:
(1) Nginx配置路径:/etc/nginx/
(2) PID目录:/var/run/nginx.pid
(3) 错误日志:/var/log/nginx/error.log
(4) 访问日志:/var/log/nginx/access.log
(5) 默认站点目录:/usr/share/nginx/html
(6) Nginx脚本指令路径:/usr/sbin/nginx
(7)Nginx 安装的模块:/usr/lib64/nginx
查询nginx 默认目录:
[root@localhost conf.d]# whereis nginx
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz /usr/share/man/man3/nginx.3pm.gz