只需 2 步即可完成部署:
public 文件夹| 组件 | 版本 |
|---|---|
| PHP | 8.0+ |
| MySQL | 5.7+ |
PHP 扩展:pdo_mysql、mbstring、openssl、curl、fileinfo、zip
重要:以下配置适用于所有 Nginx 环境,直接复制粘贴即可。
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 30d;
try_files $uri =404;
}
location /api/ {
try_files $uri $uri/ /index.php?s=$uri&$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTP_AUTHORIZATION $http_authorization;
include fastcgi_params;
}
location / {
try_files $uri $uri/ /index.html;
}
location ~ /\.(ht|git|env) {
deny all;
}⚠️ 必须配置:fastcgi_param HTTP_AUTHORIZATION $http_authorization;
否则登录后会提示"未授权"
publicpublic宝塔用户注意:fastcgi_pass 可能需要改为 unix:/tmp/php-cgi-80.sock
chmod -R 755 runtime chmod -R 755 public/storage
| 问题 | 原因 | 解决 |
|---|---|---|
| 页面 404 | 伪静态未生效 | 检查配置并重启 Nginx |
| 登录后"未授权" | Authorization 未传递 | 添加 HTTP_AUTHORIZATION 配置 |
| API 404 | 路由未转发 | 检查 location /api/ 配置 |
| 静态资源 404 | 根目录错误 | 确认指向 public 文件夹 |
https://www.eyoucms.com/geo/index.html