Files
admin-ui/ngnix.conf

60 lines
1.4 KiB
Plaintext
Raw 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.
# Nginx 静态文件服务 + 自定义 404 页面
# HTTP 重定向到 HTTPS
server {
listen 80;
server_name _;
return 301 https://$host$request_uri;
}
server {
# 静态资源根目录dist
root /usr/share/nginx/html;
index index.html;
# SSL 配置
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/scs1779764972146_redpowerfuture.com_server.crt;
ssl_certificate_key /etc/nginx/ssl/scs1779764972146_redpowerfuture.com_server.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
# 使用项目自定义静态 404 页面,保持 nginx 返回 404 状态码
error_page 404 /404.html;
location = /404.html {
internal;
}
# 根路径默认进入网页端
location = / {
return 302 /web/index.html;
}
# 兼容无斜杠访问
location = /web {
return 302 /web/;
}
location = /sys {
return 302 /sys/;
}
# 网页端public/web/index.html -> dist/web/index.html
location /web/ {
alias /usr/share/nginx/html/web/;
try_files $uri $uri/ =404;
}
# 后台管理端dist/index.html前缀 /sys/
location /sys/ {
alias /usr/share/nginx/html/;
try_files $uri $uri/ =404;
}
# 其他静态资源或任意路径,未命中时统一交给 nginx 404再由自定义 404 页面展示
location / {
try_files $uri $uri/ =404;
}
}