只需 2 步即可完成部署:
public 文件夾| 組件 | 版本 |
|---|---|
| PHP | 8.0+ |
| MySQL | 5.7+ |
PHP 擴(kuò)展:pdo_mysql、mbstring、openssl、curl、fileinfo、zip
重要:以下配置適用于所有 Nginx 環(huán)境,直接復(fù)制粘貼即可。
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;
否則登錄后會(huì)提示"未授權(quán)"
publicpublic寶塔用戶注意:fastcgi_pass 可能需要改為 unix:/tmp/php-cgi-80.sock
chmod -R 755 runtime chmod -R 755 public/storage
| 問(wèn)題 | 原因 | 解決 |
|---|---|---|
| 頁(yè)面 404 | 偽靜態(tài)未生效 | 檢查配置并重啟 Nginx |
| 登錄后"未授權(quán)" | Authorization 未傳遞 | 添加 HTTP_AUTHORIZATION 配置 |
| API 404 | 路由未轉(zhuǎn)發(fā) | 檢查 location /api/ 配置 |
| 靜態(tài)資源 404 | 根目錄錯(cuò)誤 | 確認(rèn)指向 public 文件夾 |
http://www.ubeier.com/geo/index.html