nginx环境安装magento后无法访问后台登录页面,报404错
问题描述:
nginx环境安装magento后无法访问后台登录页面,报404错,且magento日志里没有任何报错记录
解决方案:
修改nginx vhost配置:
原配置:
server { listen 80; server_name www.mymagento.com *.mymagento.com; root "D:\phpStudy\PHPTutorial\WWW\MyMagento"; location / { index index.html index.htm index.php; #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; } }
修改后配置:
server { listen 80; server_name www.mymagento.com *.mymagento.com; root "D:\phpStudy\PHPTutorial\WWW\MyMagento"; location / { #修改 index index.php index.html index.htm; #新增 try_files $uri $uri/ /index.php$is_args$args; #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;
#新增解决502报错
fastcgi_connect_timeout 500;
fastcgi_send_timeout 500;
fastcgi_read_timeout 500;
include fastcgi_params;
}
}
重启nginx服务访问正常: