# 配置 EPEL源
```
sudo yum -y update
sudo yum install -y epel-release
```
# 安装Nginx
```
sudo yum install -y nginx
```
安装成功后,默认的网站目录为: /usr/share/nginx/html

默认的配置文件为:/etc/nginx/nginx.conf

自定义配置文件目录为: /etc/nginx/conf.d/

# 防火墙
```
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
```
# Nginx命令
## 1.启动 Nginx
```
systemctl start nginx
```
## 2.停止Nginx
```
systemctl stop nginx
```
## 3.重启Nginx
```
systemctl restart nginx
```
## 4.查看Nginx状态
```
systemctl status nginx
```
## 5.启用开机启动Nginx
文章作者: zlinks
版权声明: 本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 ZFS的成长之路
linux linux
喜欢就支持一下吧