我尝试使用 Nginx 和 php-fpm 将 Magento 社区版安装到我的 VPS(在 Linode 上),但我做不到。我将 Magento 1.8.1.0 下载到我的服务器。我创建了像Magento Wiki这样的 nginx 配置。但是当我请求我的域时,它会通过 302 标头重定向到“/index.php/install/”路径,并且浏览器会出现无限循环错误。
你能建议一个解决方法吗?
编辑:我的 nginx 配置文件(我将真实域名替换为 mydomain)
server {
server_name mydomain.com www.mydomain.com;
root "/home/mydomain/public_html";
index index.php;
client_max_body_size 10m;
access_log /home/mydomain/_logs/access.log;
error_log /home/mydomain/_logs/error.log;
if ($http_user_agent ~* (Baiduspider|webalta|nikto|wkito|pikto|scan|acunetix|morfeus|webcollage|youdao) ) {
return 401;
}
if ($http_user_agent ~* (HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) ) {
return 401;
}
location / {
index index.html index.php; ## Allow a static html file to be shown first
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
expires 30d; ## Assume all files are cachable
}
## These locations would be hidden by .htaccess normally
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 /var/export/ { ## Allow admins only to view export folder
auth_basic "Restricted"; ## Message shown in login window
auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
autoindex on;
}
location /. { ## Disable .htaccess and other hidden files
return 404;
}
location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}
location ~ "^(.+\.php)($|/)" {
if (!-e $request_filename) { rewrite / /index.php last; }
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE default;
fastcgi_param MAGE_RUN_TYPE store;
fastcgi_param HTTPS $https;
fastcgi_pass unix:/var/run/mydomain_fpm.sock;
include fastcgi_params;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
location ~* \.(html|htm)$ {
expires 30m;
}
location ~* /\.(ht|git|svn) {
deny all;
}
}