专注于Magento开发与外贸SEO推广
Magento主题|Magento插件|Magento教程

Magento 2 安装 linux + nginx + php7 + mysql5.7

Magento 2.1.0 安装完整版

使用的安装环境:

linux ubuntu 14.04
Nginx 1.11.2
Mysql 5.7.1.2
PHP 7.0.8

Nginx 安装

$ sudo wget http://nginx.org/keys/nginx_signing.key

$ sudo apt-key add nginx_signing.key

$ sudo vi /etc/apt/sources.list

deb http://nginx.org/packages/mainline/debian/ jessie nginx

deb-src http://nginx.org/packages/mainline/debian/ jessie nginx

:wq 保存

$ sudo apt-get remove nginx-common

$ sudo apt-get update

$ sudo apt-get install nginx

service nginx status 查看ningx 状态

nginx 配置
whereis nginx
cd /etc/nginx
mkdir sites-available && sites-enabled
cd sites-available && vi magento

添加
`
upstream fastcgi_backend {
server unix:/var/run/php/php7.0-fpm.sock;
}

server {

    listen 80;
    server_name 2.newmagento.red;
    set $MAGE_ROOT /var/www/magento2;
    set $MAGE_MODE developer;
    include /var/www/magento2/nginx.conf.sample;

}

`

ln -s /etc/nginx/sites-available/magento /etc/nginx/sites-enabled/

vi nginx.conf

user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

service nginx restart nginx重启

Mysql 5.7 安装

wget https://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb

sudo dpkg -i mysql-apt-config_0.7.2-1_all.deb

sudo apt-get update

sudo apt-get install mysql-server

mysql -u root -p
输入密码,创建数据库

create database magentodb;
create user magentouser@localhost identified by 'magentouser@';
grant all privileges on magentodb.* to magentouser@localhost identified by 'magentouser@';
flush privileges;
\q

设置好密码

PHP 7.0.8 安装

sudo apt-get install -y language-pack-en-base

sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php

sudo apt-get update

安装扩展
sudo apt-get install php7.0 php7.0-fpm php7.0-mysql php7.0-curl php7.0-gd php7.0-xsl php7.0-json php7.0-mbstring php-gettext php7.0-mcrypt php7.0-xmlrpc libapache2-mod-php7.0 php7.0-intl php7.0-zip php7.0-cli php7.0-soap php7.0-common php7.0-mcrypt -y

安装imagemagick
sudo apt-get install imagemagick

安装Magento2.1.0

安装composer
cd ~/
curl -sS https://getcomposer.org/installer | php

mv composer.phar /usr/bin/composer

composer -v 查看版本

cd /var/www
git clone https://github.com/magento/magento2.git
git checkout 2.1.0

cd /var/www/magento2

composer install -v

bin/magento setup:install –backend-frontname=”admin” \

–key=”biY8vdWx4w8KV5Q59380Fejy36l6ssUb” \

–db-host=”localhost” \

–db-name=”magentodb” \

–db-user=”root” \

–db-password=”Miracle123″ \

–language=”en_US” \

–currency=”USD” \

–timezone=”America/New_York” \

–use-sample-data –cleanup-database \

–use-rewrites=1 \

–use-secure=0 \

–base-url=”http://2.magento.red” \

–base-url-secure=”https://2.magento.red” \

–admin-user=admin \

–admin-password=admin123 \

–admin-email=admin@example.com \

–admin-firstname=admin \

–admin-lastname=user \

–cleanup-database

安装完成,访问网址http://2.magento.red/

Magento2定时任务设置
crontab -u www-data -e
*/1 * * * * php -c /etc/php/7.0/cli/php.ini /var/www/magento2/bin/magento cron:run
*/1 * * * * php -c /etc/php/7.0/cli/php.ini /var/www/magento2/update/cron.php
*/1 * * * * php -c /etc/php/7.0/cli/php.ini /var/www/magento2/bin/magento setup:cron:run
:wq 保存

Magento根目录运行任务
bin/magento cron:run –group=”www-data”

未经允许不得转载:Magento|Magento2|magento开发|magento插件|magento主题|magento模板|magento商城|magento维护 » Magento 2 安装 linux + nginx + php7 + mysql5.7
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

Magento开发|Magento咨询QQ283475615

联系我们