27 lines
532 B
Nginx Configuration File
27 lines
532 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# 支持Next.js的路由
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# 静态文件缓存
|
|
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
|
|
expires 30d;
|
|
add_header Cache-Control "public, no-transform";
|
|
}
|
|
|
|
# 错误页面
|
|
error_page 404 /404.html;
|
|
error_page 500 502 503 504 /500.html;
|
|
|
|
# 禁用访问隐藏文件
|
|
location ~ /\. {
|
|
deny all;
|
|
}
|
|
} |