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.oriza.com 完整 Nginx 站点配置( HTTPS)
# 复制后修改 root、fastcgi_pass、证书路径, 放入 /etc/nginx/sites-available/ 并软链到 sites-enabled
# 宝塔用户:可在「网站 → 设置 → 配置文件」中参考本文件合并 location 规则
# HTTP 自动跳转 HTTPS
server {
listen 80;
server_name slake.oriza.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name slake.oriza.com;
# 证书路径按实际环境修改( Let's Encrypt / 宝塔申请后路径)
ssl_certificate /etc/letsencrypt/live/slake.oriza.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/slake.oriza.com/privkey.pem;
# 修改为服务器上 Laravel public 目录的绝对路径
root /www/wwwroot/slake.oriza.com/public;
index index.php index.html;
charset utf-8;
client_max_body_size 64m;
# ── 管理后台 SPA( Hash 路由)────────────────────────
include /www/wwwroot/slake.oriza.com/deploy/nginx-admin-spa.conf;
# 根路径跳转管理后台
location = / {
return 302 /admin/;
}
# ── Laravel 主站 ───────────────────────────────────
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/tmp/php-cgi-82.sock; # 宝塔 PHP 8.2 常见路径;或按实际 php-fpm sock 修改
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_hide_header X-Powered-By;
}
location ~ /\.(?!well-known).* {
deny all;
}
}