Magento2 搭建流程

By BenHeart

Magento2 是一个用 PHP 语言开发的开源电商平台,本文简单介绍下 Magento2 本地搭建流程。

系统要求

  • 操作系统: Linux x86-64, 如: RedHat Enterprise Linux (RHEL), CentOS, Ubuntu, Debian等
  • 内存: 2GB 以上的运行内存(RAM)
  • Web Servers:
  • Database
    • MySQL 5.6
    • Magento >= 2.1.2 兼容 MySQL 5.7
    • Magento 兼容 MariaDB 和 Percona 数据库
  • PHP
7.1.x 7.0.6–7.0.x 7.0.5 7.0.4 7.0.3
× × ×
7.0.2 7.0.0, 7.0.1 5.6.5–5.6.x 5.6.0–5.6.4 5.5.x
× × ×

环境搭建

  • MySQL 安装
  • Nginx 安装
  • PHP 及插件安装

获取 Magento2

  • 使用Composer获取Magento2(官方推荐)
cd <web server docroot directory>
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento2

修改目录属主及权限

http://devdocs.magento.com/guides/v2.1/install-gde/install-quick-ref.html

安装 Magento2

官方安装文档: http://devdocs.magento.com/guides/v2.1/install-gde/install-quick-ref.html

  • Command-line安装
  • Web Setup Wizard安装

网页安装带有Simple Data的Magento2时,进度经常会卡在73%,需要更改Magento2安装根目录中的nginx.conf.simple

location ~ ^/setup/index.php {
    fastcgi_pass   fastcgi_backend;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

添加下面两行代码,增大超时的时间:

location ~ ^/setup/index.php {
    fastcgi_pass   fastcgi_backend;
    fastcgi_read_timeout 600s;
    fastcgi_connect_timeout 600s;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

参考链接

about theme

BenHeart

A graduate from HIT, attention to the Network Programming, Website Development, Data Mining.

GitHub Repository