FastAdmin項目從window部署到linux出現404或者插件無法訪問
這種情況一般在Nginx下未配置僞靜態的情況下出現,建議將虛擬主機的root綁定至public目錄
例如:
server {
listen 80;
server_name www.fa.com *.fa.com;
root "C:/phpstudy/WWW/fastadmin/public";
location / {
index index.html index.htm index.php;
#主要是這一段一定要確保存在
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
#結束
#autoindex on;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
如果你使用的是 lnmp.org 的一鍵安裝LNMP環境
更改代碼如下
server
{
listen 80;
#listen [::]:80;
server_name localhost;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.stallarousal.com/public;
location /www.stallarousal.com/ {
if (!-e $request_filename){
rewrite ^/www.stallarousal.com/public/(.*)$ /www.stallarousal.com/public/index.php?s=/$1 last;
}
}
include enable-php-pathinfo.conf; #開啓pathinfo
#include other.conf;
#error_page 404 /404.html;
#include enable-php.conf; #關閉
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
access_log off; #未開啓log
}