Я новичок в magento и nginx и пытаюсь исправить неработающие ссылки на сайте.
В моем журнале ошибок для nginx у меня есть следующее:
09.09.2017 17:09:00 [ошибка] 23457 # 23457: * 15 цикл перезаписи или внутреннего перенаправления при обработке «/index.php», клиент: 127.0.0.1, сервер: localhost, запрос: «GET / index. php HTTP / 1.1 «, хост:» localhost «, реферер:»HTTP: // локальный / принцесса шоссе /«
В моем файле конфигурации по умолчанию для 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: // локальный / принцесса шоссе / контакты
Пропустив index.php по ссылке, я получу ошибку 500 шлюзов.
Я довольно новичок в этом, поэтому дайте мне знать, если я могу предоставить дополнительную информацию.
Спасибо!
Использование ответа в качестве комментариев, так как мне нужно форматирование
Попробуйте добавить местоположение
location /princess-highway/ {
rewrite /princess-highway/(.*) /princess-highway/index.php/$1;
}
Других решений пока нет …