Files
cnblogs/dcrenl/CentOS 8 上安装和配置 nginx.md
2024-09-24 12:43:01 +08:00

56 lines
860 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

**1、检查yum上的nginx版本**
```shell
yum info nginx
```
**2、安装nginx**
```shell
yum install nginx
```
###### 安装过程有时会询问是否安装输入y回车即可
**3、将服务设置为每次开机启动**
```shell
sudo systemctl enable nginx
```
**4、启动nginx服务**
```shell
sudo systemctl start nginx
```
**5、查看nginx服务状态**
```shell
sudo systemctl status nginx
```
**6、检查防火墙状态**
```shell
firewall-cmd --state
```
**7、设置防火墙添加80、443端口**
```shell
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
```
**8、重新加载防火墙配置**
```shell
sudo firewall-cmd --reload
```
**9、验证nginx**
在浏览器中输入nginx的访问地址如出现nginx欢迎页时配置成功。