CentOS 7 yum源安装Nginx

前端之家收集整理的这篇文章主要介绍了CentOS 7 yum源安装Nginx前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

教程中的步骤需要root用户权限或者sudo

1.添加Nginx Repository

yum install epel-release

2.安装Nginx

yum install Nginx

3.启动Nginx服务

systemctl start Nginx

如果开着防火墙,请运行如下命令:

firewall-cmd --permanent --zone=public --add-service=http 
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

4.访问IP地址

http://IP/

如果能看到此页面则说明Nginx运作正常!

5.开机自动启动Nginx

systemctl enable Nginx

6.Nginx配置信息

网站文件存放默认目录

  /usr/share/Nginx/html

网站默认站点配置

  /etc/Nginx/conf.d/default.conf

自定义Nginx站点配置文件存放目录

  /etc/Nginx/conf.d/

Nginx全局配置

  /etc/Nginx/Nginx.conf

在这里你可以改变设置用户运行Nginx守护程序进程一样,和工作进程的数量得到了Nginx正在运行,等等。

更多systemctl命令可查看《systemctl命令用法》。

原文链接:https://www.f2er.com/centos/379501.html

猜你在找的CentOS相关文章