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.

51 lines
1.7 KiB

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