春风十里不如你 —— Taozi - 欧拉 欧拉麒麟系统OpenEuler 2023-09-08T15:33:00+08:00 Typecho https://www.xiongan.host/index.php/feed/atom/category/openeuler/ <![CDATA[【欧拉】OpenEuler搭建Nginx]]> https://www.xiongan.host/index.php/archives/220/ 2023-09-08T15:33:00+08:00 2023-09-08T15:33:00+08:00 admin https://www.xiongan.host OpenEuler的web服务器

基础环境

查看系统环境版本

[root@taozi ~]# cat /etc/os-release 
NAME="openEuler"
VERSION="21.09"
ID="openEuler"
VERSION_ID="21.09"
PRETTY_NAME="openEuler 21.09"
ANSI_COLOR="0;31"

配置环境

首先配置本地yum源,搭建repo服务器

清理缓存,重新创建缓存

[root@taozi ~]# dnf clean all
[root@taozi ~]# dnf makecache
#安装nginx服务
[root@taozi ~]# dnf install nginx -y

查看安装后的rpm包

image-20230908113541930

启动nginxi服务并设置开机自启

[root@taozi ~]# systemctl start nginx
[root@taozi ~]# systemctl enable nginx

查看服务状态

image-20230908113750924

Nginx服务的配置文件

/etc/nginx/nginx.conf 主要的配置文件

/etc/nginx/conf.d 配置文件的辅助目录,也包含在主配置文件当中

/usr/share/nginx/html web网站的index文件所在目录

查看语法错误【syntax is ok】

image-20230908114217048

配置防火墙

# firewall-cmd --add-service=http --permanent
success
# firewall-cmd --reload
success

验证成功

image-20230908114803018

]]>