Update nginx.conf

main
pmsyffau9 8 months ago
parent 6287041b03
commit 16ffc23bc8

@ -1,22 +1,44 @@
# 定义一个server块它代表一个虚拟主机或站点。
server { server {
# 监听在HTTP标准端口80上这是未加密的HTTP流量的标准端口。
listen 80; listen 80;
# 指定该服务器块响应哪些域名的请求。这里是mini-admin.mall4j.com。
server_name mini-admin.mall4j.com; server_name mini-admin.mall4j.com;
# 开启Gzip压缩功能以减少传输的数据量提高页面加载速度。
gzip on; gzip on;
# 如果存在预压缩的静态资源(如.html.gz则优先提供这些压缩后的资源。
gzip_static on; gzip_static on;
# 定义处理所有请求的location块。
location / { location / {
# 尝试按照顺序查找文件:先找精确匹配的文件路径,然后是目录,最后尝试根路径。
try_files $uri $uri/ /; try_files $uri $uri/ /;
# 设置Web根目录的位置即网站文件存放的目录。
root /usr/share/nginx/html/dist; root /usr/share/nginx/html/dist;
# 当访问根路径时,默认提供的首页文件名。
index index.html; index index.html;
} }
# 当出现404错误找不到页面重定向到指定的404错误页面。
error_page 404 /404.html; error_page 404 /404.html;
location = /404-light.html {
# 特别指定当访问路径为/404-light.html时的处理方式。
location = /404-light.html {
# 这里没有额外配置,意味着它将按照默认规则处理此特定路径。
# 使用"="表示精确匹配只有当请求完全符合这个URL时才会触发。
} }
# 对于500系列的服务器错误重定向到指定的50x错误页面。
error_page 500 502 503 504 /50x.html; error_page 500 502 503 504 /50x.html;
location = /50x.html {
# 特别指定当访问路径为/50x.html时的处理方式。
location = /50x.html {
# 类似于上面的404-light.html配置这里也没有额外配置。
# "location = /50x.html"确保了只有当请求的是/50x.html时才会应用这个location块。
} }
} }
Loading…
Cancel
Save