我覺得我有點迷路了。現有的Apache .htaccess到Nginx配置
我嘗試了一些解決方案,但我沒有得到一個部分。一切都必須由index.php處理,我不能讓它在nginx中工作。我一直在學習Nginx,但真的很感謝某些人的快速幫助。
我的.htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?_route_=$1 [L,QSA]
我的Nginx的配置是:
server {
listen 80;
listen [::]:80;
root /folder;
index index.php index.html index.htm index.nginx-debian.html;
server_name hostname.com;
location/{
try_files $uri $uri/ =404;
}
location ~ \.php$ {
try_files = $uri @missing;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location @missing {
rewrite^$scheme://$host/index.php permanent;
}
}
有人可以點我朝着正確的方向?謝謝
以及究竟是你的問題?什麼「沒有得到它的工作」是什麼意思?請閱讀:https://stackoverflow.com/help/mcve –
嘿Maciej, 我的不好。我有我的客戶想要在他們的新nginx服務器上擁有的舊cms。問題是應用程序使用工作,所以它採取whatever.php「任何」,並將其用作動態標題。所以PHP應用程序讀取index.php作爲主頁。其他任何東西都是作爲標題,並且有針對特定頁面內容的mysql查詢。 – user8614226
請編輯您的原始問題與所有這些細節。確保你清楚地說明問題並提出不希望的和期望的效果。 –