使用Nginx时从Magento URL中删除index.php
我目前的设置是运行Ubuntu12.04LTS、nginx1.4.1和Magento1.7.0.2 今天早些时候,我建立了一个基本的Magento商店。我没有安装任何模块,也没有进行任何配置更改。我只是想在深入研究这个系统之前打好基础。我希望删除出现在域名和文件路径之间的“index.php” 我的vhost来自nginx网站:使用Nginx时从Magento URL中删除index.php,magento,nginx,Magento,Nginx,我目前的设置是运行Ubuntu12.04LTS、nginx1.4.1和Magento1.7.0.2 今天早些时候,我建立了一个基本的Magento商店。我没有安装任何模块,也没有进行任何配置更改。我只是想在深入研究这个系统之前打好基础。我希望删除出现在域名和文件路径之间的“index.php” 我的vhost来自nginx网站: server { root /path/to/root/domain/html; index index.php; error_log /pa
server {
root /path/to/root/domain/html;
index index.php;
error_log /path/to/error/log/error.log;
access_log /path/to/transfer/log/transfer.log;
server_name servername.com;
location / {
index index.html index.php;
try_files $uri $uri/ @handler;
expires 30d;
}
location ^~ /(app|includes|lib|media/downloadable|pkginfo|report/config.xml|var)/ { internal; }
location /var/export/ { internal; }
location /. { return 404; }
location @handler { rewrite / /index.php; }
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 SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE default;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;
}
}
我看到其他人一直在寻找这个问题的答案,有一些解决方案的代码片段,但这些似乎都不适用于我的系统。当我更改我的Nginx vhost时,我总是重新启动Nginx,但是index.php仍然显示在URL中 Nginx配置看起来不错。在管理面板中的
system>configuration>general>web
中,设置使用web服务器将重写为yes
并清除magento中的缓存。将其添加到magento nginx vhost中
location / {
if (!-e $request_filename) {
rewrite ^/([^?]*)(?:\?(.*))? /index.php?title=$1&$2 last;
}
if ($uri ~* "\.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$") {
expires max;
break;
}
}
如果无法访问4040的仪表板,如何在shell或datrabase上修改此值?