You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# 定义一个server块, 它代表一个虚拟主机或站点。
server {
# 监听在HTTP标准端口80上, 这是未加密的HTTP流量的标准端口。
listen 80 ;
# 指定该服务器块响应哪些域名的请求。这里是mini-admin.mall4j.com。
server_name mini-admin.mall4j.com ;
# 开启Gzip压缩功能, 以减少传输的数据量, 提高页面加载速度。
gzip on ;
# 如果存在预压缩的静态资源(如.html.gz) , 则优先提供这些压缩后的资源。
gzip_static on ;
# 定义处理所有请求的location块。
location / {
# 尝试按照顺序查找文件:先找精确匹配的文件路径,然后是目录,最后尝试根路径。
try_files $uri $uri/ / ;
# 设置Web根目录的位置, 即网站文件存放的目录。
root /usr/share/nginx/html/dist ;
# 当访问根路径时,默认提供的首页文件名。
index index.html ;
}
# 当出现404错误( 找不到页面) 时, 重定向到指定的404错误页面。
error_page 404 /404.html ;
# 特别指定当访问路径为/404-light.html时的处理方式。
location = /404-light.html {
# 这里没有额外配置,意味着它将按照默认规则处理此特定路径。
# 使用"="表示精确匹配, 只有当请求完全符合这个URL时才会触发。
}
# 对于500系列的服务器错误, 重定向到指定的50x错误页面。
error_page 500 502 503 504 /50x.html ;
# 特别指定当访问路径为/50x.html时的处理方式。
location = /50x.html {
# 类似于上面的404-light.html配置, 这里也没有额外配置。
# "location = /50x.html"确保了只有当请求的是/50x.html时, 才会应用这个location块。
}
}