我是magento和nginx的新手,並且正在嘗試修復網站上斷開的鏈接。Magento nginx在處理「/index.php」時重寫或內部重定向週期
在我的錯誤日誌nginx的我有以下幾點:
2017年9月11日十七時09分00秒[錯誤] 23457#23457:* 15重寫或內部重定向週期在處理「的index.php 「,client:127.0.0.1,server:localhost,request:」GET /index.php HTTP/1.1「,主機:」localhost「,referrer:」http://localhost/princess-highway/「
在我的默認配置文件爲nginx我有以下:
# magento specific nginx config for the frontend
server {
listen 80;
server_name localhost;
root /var/www/html;
# check if Load Balancer handled SSL
set $elb_https "off";
if ($http_x_forwarded_proto = "https") {
set $elb_https "on";
}
add_header X-Whom $hostname;
client_max_body_size 2m;
location/{
index index.html index.php;
try_files $uri $uri/ @handler;
# testing found online
# try_files $uri $uri/ /index.php?$query_string;
expires 30d; ## Assume all files are cachable
}
## block access
location /app/ { deny all; }
location /includes/ { deny all; }
location /lib/ { deny all; }
location /media/downloadable/ { deny all; }
location /pkginfo/ { deny all; }
location /report/config.xml { deny all; }
location /var/ { deny all; }
location /downloader/ { deny all; }
location /errors/ { deny all; }
location /shell/ { deny all; }
location ~ rss/catalog/(review|notifystock) {
deny all;
}
## disable .htaccess and other hidden files
location /. {
return 404;
}
## block API access on non-admin instances
location /api { deny all; }
## block rss feeds
location /rss { return 404; }
## block test scripts
location ^~ /dev/ { return 403; }
## disable hidden files, git files + composer.json
location ~ /(\.|\.git|composer.json|composer.lock) {
return 404;
}
## allow access
location /var/google/ { allow all; }
#location /admin {
# rewrite ^.* http://localhost/factoryx permanent;
#}
#location /factoryx {
# rewrite ^.* https://ao-admin.ap-southeast-2.staging.factoryx.io/factoryx permanent;
#}
location ~ "^/media/picklists/[a-zA-Z0-9]{32}/$" {
autoindex on;
autoindex_localtime on;
}
## Magento uses a common front handler
location @handler {
rewrite//index.php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 1y;
log_not_found off;
}
## Forward paths like /js/index.php/x.js to relevant handler
location ~ .php/ {
rewrite ^(.*.php)/ $1 last;
}
location ~ .php$ {
if (!-e $request_filename) { rewrite//index.php last; }
expires off;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param HTTPS $elb_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE default;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
fastcgi_read_timeout 300;
}
}
我有這樣的聯繫: http://localhost/princess-highway/index.php/contacts 上面的鏈接將工作,但導航菜單上的實際鏈接將帶你在這裏: http://localhost/princess-highway/contacts 從鏈接省略的index.php,我會得到一個500錯誤網關錯誤。
我很新,所以讓我知道,如果我可以提供進一步的信息。
謝謝!
總之你想要什麼你的配置,現在怎麼辦?你想'http:// localhost/princess-highway/contacts'自動翻譯成http:// localhost/princess-highway/index.php/contacts'嗎?對於這條路還是其他幾條路呢? –
是的,這將是理想的!這也適用於其他一些路徑。 –
直接在瀏覽器中使用'http:// localhost/princess-highway/index.php/contacts'這個工作嗎? –