LNMP环境magento常见错误

一、安装报404错误

git clone 下最新代码,跳转到index/install 安装时出现404错误

需要把伪静态规则加到nginx配置文件中:

#
# The default server
#
server {
    listen       8090;
    #server_name  _;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
        root   /usr/share/nginx/html/hoh;
        index  index.php index.html index.htm;
    try_files $uri $uri/ @handler; ## If missing pass the URI to Magento’s front handler
        #add_header Access-Control-Allow-Origin *;
        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;
    }
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        root           /usr/share/nginx/html/hoh;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

重启nginx后正常安装。

二、后台404错误

1.检查后台地址是否输入错误

打开app/etc/local.xml

<frontName><![CDATA[admin]]></frontName>

那么后台登陆地址就是 域名/admin

2.如果后台地址无误,执行下面sql语句,表名根据自身是否有加前缀

SET FOREIGN_KEY_CHECKS=0;
UPDATE `core_store` SET store_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
UPDATE `core_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;

3.删除 var文件夹下cache文件夹和session文件夹下的所有内容

 

posted @ 2016-03-09 17:08  Jeff.Gao  阅读(1132)  评论(0编辑  收藏  举报