CentOS 7 Nginx 安装 Magento 1.9

sudo vi /etc/nginx/nginx.conf
location / {
    try_files $uri $uri/ /index.php?$args;
}
location  /. {
    return 404;
}
location /media {
    try_files $uri $uri/ /get.php?$args;
}
取消 PHP 执行权限:
location ~ ^/media/.*\.(php|php5)?$ {
    deny all;
}

sudo chmod -R 777 magento/

安装时如果出现:PHP extension "mcrypt" must be loaded.
执行:
sudo php5enmod mcrypt
sudo systemctl restart php5-fpm

安装插件时如果出现:Warning: Your Magento folder does not have sufficient write permissions.
执行:
sudo chmod -R 777 magento/

安装完毕一定要改回755权限:
sudo chmod -R 755 magento/
#sudo chmod -R 777 magento/app/etc/
sudo chmod -R 777 magento/media/
sudo chmod -R 777 magento/var/
sudo chown -R root:root magento/

修改管理后台路径:
sudo vi magento/app/etc/local.xml

    
        
    

在后台清理缓存或者清空var/cache目录

启用登陆表单验证码:
系统 - 配置 - 高级 - 管理员 - CAPTCHA

cd magento/
sudo rm .htaccess.sample index.php.sample install.php LICENSE.html LICENSE.txt LICENSE_AFL.txt php.ini.sample RELEASE_NOTES.txt

插件安装完毕后建议禁止访问downloader目录:
location ~ ^/downloader/ {
    deny all;
}
根据.htaccess文件配置禁止访问目录:
location ~ ^/(app|dev|includes|lib|media/customer|media/downloadable|shell|var)/ {
    deny all;
}
location ~ ^/downloader/.*\.(cfg|ini|xml)?$ {
    deny all;
}
location ~ ^/errors/.*\.(xml|phtml)?$ {
    deny all; 
}

去除 URL 中的 index.php
System - Configuration - Web - Search Engines Optimization - Use Web Server Rewrites: Yes

开发时禁用缓存:
系统 - 缓存管理 - 全选 - 禁用