繁体   English   中英

带有magento的每个页面上的Nginx 404错误(首页除外)

[英]Nginx 404 error on every page with magento (except front page)

我为此感到震惊。 我有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文件确实起作用。

我也有同样的问题。

使用这样的链接:magento181 / index.php / prodct

安装地点:magento181 /产品

这是网址重写问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM