CentOS 1810 预构建安装使用 Nginx

相关文章:

Nginx 官方文档:Installing NGINX Open Source

CentOS 1810 源码安装使用 Nginx

CentOS 使用 Nginx 实现 同一台服务器 多域名 对应 多项目


  1.  安装 EPEL:
    yum -y install epel-release
  2. 安装 EPEL 后更新系统:
    yum -y update
  3. 安装 Nginx:
    yum -y install nginx
  4. 查看 Nginx 版本:
    [root@CentOS-7-x86-64-DVD-1810 ~]# nginx -v
    nginx version: nginx/1.12.2
    
  5. 打开 http 服务(80端口):
    firewall-cmd --zone=public --add-service=http --permanent
    或:
    firewall-cmd --zone=public --add-port=80/tcp --permanent
  6. 重新加载防火墙:
    firewall-cmd --reload
    或重启防火墙(不推荐,防火墙将出现中断):
    systemctl restart firewalld
  7. 查看已开启的服务(端口):
    firewall-cmd --list-all
  8. 启动 Nginx:
     systemctl start nginx
  9. 查看 Nginx 状态:
     systemctl status nginx
  10. 开启 Nginx 开机自启:
    systemctl enable nginx
  11. 查看 Nginx 开机自启状态:
    systemctl list-unit-files | grep nginx
  12. 访问效果:

     
  13. 查找 Nginx 配置文件:
    [root@CentOS-7-x86-64-DVD-1810 ~]# find / -name nginx.conf
    /etc/nginx/nginx.conf
    
发布了94 篇原创文章 · 获赞 32 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/qq_32596527/article/details/93340370