我正在打破这个问题。
我有magento 1.8.1
并将其迁移到nginx服务器(来自apache)
主页确实有效,但当我尝试转到其他页面(如类别或产品页面)时,我从Nginx收到404错误。 我无法解决这个问题。
我安装并运行了php-fpm。
nginx version: nginx/1.1.19
和
PHP 5.3.10-1ubuntu3.12 (fpm-fcgi) (built: Jun 20 2014 00:40:17)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd.
我的nginx.conf
:
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
##
# Basic Settings
##
server_tokens off;
sendfile on;
keepalive_timeout 5;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
map $scheme $fastcgi_https { ## Detect when HTTPS is used
default off;
https on;
}
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log notice;
rewrite_log on;
log_format main ?$remote_addr - $remote_user [$time_local] $request ?
??$status? $body_bytes_sent ?$http_referer? ?
??$http_user_agent? ?$http_x_forwarded_for??;
##
# Gzip Settings
##
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
我的site.conf
:
server {
listen 80 default_server;
server_name xxx.stratoserver.net www.xxx.stratoserver.net; # like ServerName in Apache
root /var/www/vhosts/path_to; # document root
autoindex off; # we don’t want users to see files in directories
#ensure sensitive files are not accessible
location ~ (^/(app/\|includes/\|lib/\|/pkginfo/\|var/\|report/config.xml)\|/\.svn/\|/\.git/\|/.hta.+) {
deny all; }
location / {
index index.php index.html index.htm;
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
expires 30d; ## Assume all files are cachable
if ($request_filename ~* ^.*?/([^/]*?)$)
{
set $filename $1;
}
if ($filename ~* ^.*?\.(eot)|(ttf)|(woff)$){
add_header Access-Control-Allow-Origin *;
}
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 360d;
}
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;
}
}
谁可以帮助我让网站的其余部分运行。
phpinfo.php
文件确实有效。
答案 0 :(得分:0)
我也有同样的问题。
使用这样的链接:magento181 / index.php / prodct
instade of:magento181 / product
这是网址重写问题..