Redhat 8 安装Nginx

admin
2024-06-16 / 0 评论 / 126 阅读 / 正在检测是否收录...

nginx 部署

yum|dnf  源部署

nginx 依赖与第三方源 epel

1、安装第三方源

[root@localhost lvm-test]# yum -y install epel-release
[root@localhost lvm-test]# ls /etc/yum.repos.d/
a.repo_bak  bak  CentOS-Base.repo  epel.repo  epel-testing.repo

2、查找nignx服务

[root@localhost lvm-test]# yum search nginx

3、安装nginx

[root@localhost lvm-test]# yum install  nginx -y 

4、启动nginx服务

789版本

systemclt[系统管理命令]  start(开启)|stop(停止) | reload(重新加载)| enable (开机自启服务) | disable(开机不自启动)  [服务的名称]
[root@localhost lvm-test]# systemctl  start nginx     

6版本

serivce  [服务名称] start |stop

5、添加防火墙规则

  • 7 8 firewalld
#临时修改
[root@localhost lvm-test]# firewall-cmd   --add-port=80/tcp
  • iptables

6、修改Selinux

  • 查看selinux状态
[root@localhost lvm-test]# getenforce
Enforcing   #严格模式
  • 设置Selinux
#临时修改
[root@localhost lvm-test]# setenforce 0   0#表示宽松模式   1#严谨模式

Seliunx 工作流程图:

lxhhq3qx.png

7、测试

使用搜索引擎浏览器在地址栏中:http://serverIP

0

评论 (0)

取消