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.
# 示例: slake.ali251.langye.net 完整 Nginx 站点配置( HTTPS)
# 复制后修改 root、fastcgi_pass、证书路径, 放入 /etc/nginx/sites-available/ 并软链到 sites-enabled
# HTTP 自动跳转 HTTPS
server {
listen 80;
server_name slake.ali251.langye.net;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name slake.ali251.langye.net;
# 证书路径按实际环境修改( Let's Encrypt 示例)
ssl_certificate /etc/letsencrypt/live/slake.ali251.langye.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/slake.ali251.langye.net/privkey.pem;
# 修改为服务器上 Laravel public 目录的绝对路径
root /var/www/slake-school-service/public;
index index.php index.html;
charset utf-8;
client_max_body_size 64m;
# ── 管理后台 SPA( Hash 路由)────────────────────────
include /var/www/slake-school-service/deploy/nginx-admin-spa.conf;
# 根路径跳转管理后台
location = / {
return 302 /admin/;
}
# ── Laravel 主站 ───────────────────────────────────
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; # 按实际 PHP 版本修改
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_hide_header X-Powered-By;
}
location ~ /\.(?!well-known).* {
deny all;
}
}