1. 程式人生 > >Fecshop的安裝以及配置

Fecshop的安裝以及配置

Fecshop安裝

1、安裝WAMP

2、百度雲中下載最新fecshop:https://pan.baidu.com/s/1hs1iC2C#list/path=/

解壓,資料夾內容放到自己的資料夾下面

3、配置本地的host指向

開啟檔案C:\Windows\System32\drivers\etc

hosts屬性 安全 Users許可權改為完全控制

開啟hosts檔案在hosts檔案最後新增

127.0.0.1       rock.fecshoptest.com     # rockmongo的域名指向,rockmongo是mongodb的視覺化介面,類似於mysql的phpmyadmin
127.0.0.1       my.fecshoptest.com       # mysql的phpmyadmin的域名指向
127.0.0.1       appadmin.fecshoptest.com # 後臺域名指向
127.0.0.1       appfront.fecshoptest.com # 前臺pc端域名指向
127.0.0.1       appfront.fecshoptest.es  # 前臺pc端 es 語言的域名指向
127.0.0.1       apphtml5.fecshoptest.com # 前臺html端的域名指向
127.0.0.1       appapi.fecshoptest.com   # api端的域名指向
127.0.0.1       appserver.fecshoptest.com # server端的域名指向
127.0.0.1       img.fecshoptest.com        #appimage/common   圖片的域名指向
127.0.0.1       img2.fecshoptest.com    #appimage/appadmin 圖片的域名指向
127.0.0.1       img3.fecshoptest.com    #appimage/appfront 圖片的域名指向
127.0.0.1       img4.fecshoptest.com    #appimage/apphtml5 圖片的域名指向
127.0.0.1       img5.fecshoptest.com    #appimage/appserver圖片的域名指向

3.修改apache的配置

開啟檔案wamp\bin\apache\apache2.4.23\conf\ extra\httpd-vhosts.conf檔案

# appfront.fecshoptest.com -> xxx/appfront/web 
# appfront.fecshoptest.es  -> xxx/appfront/web 
<VirtualHost *:80>
    ServerName appfront.fecshoptest.com
    ServerAlias appfront.fecshoptest.es
    DocumentRoot D:/wamp/www/fecshop/appfront/web
    <Directory  "D:/wamp/www/fecshop/appfront/web/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

# appadmin.fecshoptest.com -> xxx/appadmin/web
<VirtualHost *:80>
    ServerName appadmin.fecshoptest.com
    ServerAlias appadmin.fecshoptest.com
    DocumentRoot D:/wamp/www/fecshop/appadmin/web
    <Directory  "D:/wamp/www/fecshop/appadmin/web/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

# apphtml5.fecshoptest.com -> xxx/apphtml5/web
<VirtualHost *:80>
    ServerName apphtml5.fecshoptest.com
    ServerAlias apphtml5.fecshoptest.com
    DocumentRoot D:/wamp/www/fecshop/apphtml5/web
    <Directory  "D:/wamp/www/fecshop/apphtml5/web/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

# appapi.fecshoptest.com -> xxx/appapi/web
<VirtualHost *:80>
    ServerName appapi.fecshoptest.com
    ServerAlias appapi.fecshoptest.com
    DocumentRoot D:/wamp/www/fecshop/appapi/web
    <Directory  "D:/wamp/www/fecshop/appapi/web/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>


# appserver.fecshoptest.com -> xxx/appserver/web
<VirtualHost *:80>
    ServerName appserver.fecshoptest.com
    ServerAlias appserver.fecshoptest.com
    DocumentRoot D:/wamp/www/fecshop/appserver/web
    <Directory  "D:/wamp/www/fecshop/appserver/web/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

# img.fecshoptest.com -> xxx/appimage/common
<VirtualHost *:80>
    ServerName img.fecshoptest.com
    ServerAlias img.fecshoptest.com
    DocumentRoot D:/wamp/www/fecshop/appimage/common
    <Directory  "D:/wamp/www/fecshop/appimage/common/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>


# img2.fecshoptest.com -> xxx/appimage/appadmin
<VirtualHost *:80>
    ServerName img2.fecshoptest.com
    ServerAlias img2.fecshoptest.com
    DocumentRoot D:/wamp/www/fecshop/appimage/appadmin
    <Directory  "D:/wamp/www/fecshop/appimage/appadmin/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>


# img3.fecshoptest.com -> xxx/appimage/appfront
<VirtualHost *:80>
    ServerName img3.fecshoptest.com
    ServerAlias img3.fecshoptest.com
    DocumentRoot D:/wamp/www/fecshop/appimage/appfront
    <Directory  "D:/wamp/www/fecshop/appimage/appfront/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

# img4.fecshoptest.com -> xxx/appimage/apphtml5
<VirtualHost *:80>
    ServerName img4.fecshoptest.com
    ServerAlias img4.fecshoptest.com
    DocumentRoot D:/wamp/www/fecshop/appimage/apphtml5
    <Directory  "D:/wamp/www/fecshop/appimage/apphtml5/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>


# img5.fecshoptest.com -> xxx/appimage/appserver
<VirtualHost *:80>
    ServerName img5.fecshoptest.com
    ServerAlias img5.fecshoptest.com
    DocumentRoot D:/wamp/www/fecshop/appimage/appserver
    <Directory  "D:/wamp/www/fecshop/appimage/appserver/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>
對應連結地址的的修改,頁面訪問對應連結

訪問 appfront.fecshoptest.com 頁面出現對應資料夾

4、安裝mongodb,redis的php擴充套件

https://pecl.php.net/package/mongodb/1.3.2/windows 下載對應的兩個資料夾

把裡面的檔案php_mongodb.dll php_redis.dll放到\wamp\bin\php\php7.0.10\ext目錄下

修改兩處php.ini的配置(php.ini檔案下面新增)

extension=php_mongodb.dll
extension=php_redis.dll

5、安裝redis:

redis下載:https://github.com/MicrosoftArchive/redis/releases

頁面下載Redis-x64-3.2.100.msi下載成功直接點選安裝,安裝完畢,cmd執行

redis-cli

6、安裝fecshop

cd /d  D:\wamp\www\fecshop
php init
  [0] Development
輸入0 回車

Initialize the application under 'Development' environment? [yes|no]
輸入y 回車

7、修改store key 修改檔案

wamp\www\fecshop\appfront\config\fecshop_local_services\Store.php 把域名fecshop.appfront.fancyecommerce.com 替換成 appfront.fecshoptest.com

8、安裝mongodb: 下載地址:https://www.mongodb.com/download-center

安裝完mongodb,選擇安裝到D盤D:\Program Files目錄下,我的mongoDB安裝在D:\Program Files資料夾中。 在MongoDB的安裝目錄下,找到bin目錄。

1)在目錄下面新建資料夾 data,用於MongoDB資料庫存放。

2)新建檔案: mongodb.config,開啟檔案,在檔案中寫入: dbpath=D:\Program Files\MongoDB\Server\3.4\bin\data

在bin資料夾找開cmd控制檯,執行下面命令:

mongod --config mongodb.config

9、安裝完成

重啟apache2,瀏覽器輸入:http://appfront.fecshoptest.com/ 就可以出現fecshop主頁


Fecshop初始配置

1、配置 fecshop app advanced

fecshop\common\config\main-local.php

<?php
return [
    'components' => [
        // Mysql部分的配置
        'db' => [ 
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=127.0.0.1;dbname=fecshop',
            'username' => 'root',
            'password' => 'xxxxxx',
            'charset' => 'utf8',
        ],
        // Mongodb部分的配置
        'mongodb' => [
            'class' => 'yii\mongodb\Connection',
			# 有賬戶的配置
            //'dsn' => 'mongodb://username:[email protected]:27017/datebase',
			# 無賬戶的配置
			'dsn' => 'mongodb://127.0.0.1:27017/fecshop_test_2017_04_19',
			# 複製集
			//'dsn' => 'mongodb://10.10.10.252:10001/erp,mongodb://10.10.10.252:10002/erp,mongodb://10.10.10.252:10004/erp?replicaSet=terry&readPreference=primaryPreferred',
        ],
		// Redis的配置
		'redis' => [
            'class' => 'yii\redis\Connection',
            'hostname' => '127.0.0.1',    // redis的host
            'port' => 6379,               // redis的埠     
			//'password'  => 'xxxxx', // redis的密碼
            'database' => 0,    // redis的庫,此處不要改動
        ],
        // Cache 元件的配置,您需要配置下面的redis
        'cache' => [
            'class'     => 'yii\redis\Cache',
            // 快取配置獨立的redis,您可以和上面的redis配置一致
            'redis' => [
                'hostname' => '127.0.0.1',   // redis的host
                'port' => 6379,              // redis的埠   
                //'password'  => 'xxxxx', // redis的密碼
            ],
        ],
        // Session 元件的配置,您需要配置下面的redis
        'session' => [
            'class'   => 'yii\redis\Session',
            // session過期時間,1天過期
            'timeout' => 86400 * 1, 
            // 快取配置獨立的redis,您可以和上面的redis配置一致
            'redis' => [
                'hostname' => '127.0.0.1', // redis的host
                'port' => 6379,            // redis的埠   
                //'password'  => 'xxxxx', // redis的密碼
            ],
        ],
    ]
]

密碼設定為空

2、配置語言(可以先使用預設):

在配置檔案(:@common\config\fecshop_local_services\FecshopLang.php

3、配置貨幣(可以先使用預設):

在檔案:@common\config\fecshop_local_services\Page.php

4、配置store的域名

針對前臺訪問入口的,也就是appfront(pc) apphtml5(wap) appserver(app) 幾個入口的,對於console appadmin 是不需要配置Store.php 的,因為後臺是沒有多store的概念的

fecshop.appfront.fancyecommerce.com 替換成 appfront.fecshoptest.com

按照此格式替換三個入口

5、圖片域名配置檔案:@common\config\fecshop_local_services\Image.php ,譬如我的程式碼(您可以和我的保持一致,相應域名已經在上面新增host):

<?php
/**
 * FecShop file.
 * @link http://www.fecshop.com/
 * @copyright Copyright (c) 2016 FecShop Software LLC
 * @license http://www.fecshop.com/license/
 */
return [
	'image' => [
		'appbase'	=> [
			'appfront' => [
				'basedir' => '@appimage/appfront',
				'basedomain' => '//img3.fecshoptest.com',
			],
			'apphtml5' => [
				'basedir' => '@appimage/apphtml5',
				'basedomain' => '//img2.fecshoptest.com',
			],
			'appadmin' => [
				'basedir' => '@appimage/appadmin',
				'basedomain' => '//img2.fecshoptest.com',
			],
			'common' => [
				'basedir' => '@appimage/common',
				'basedomain' => '//img.fecshoptest.com',
			],
		],
	],
];

6、測試資料安裝

https://pan.baidu.com/s/1kVwRD2Z#list/path=%2F環境部署%2Ffecshop測試資料包

把fecshop.sql 匯入到mysql中
匯入mongodb測試資料

上面下載的資料夾中的檔案mongo-fecshop-20180212-110657.js上傳到您的系統中

下載的檔案路徑執行cmd 執行

mongo 127.0.0.1:27017/fecshop --quiet mongo-fecshop-20180212-110657.js

7、產品圖片

上面下載的appimage解壓,覆蓋原目錄fecshop\appadmin

如果發現產品圖片沒有出來,那麼您需要清空 appimage/common/media/catalog/product/cache/*下面所有檔案和資料夾

8、後臺的賬戶密碼為: admin admin123

http://appadmin.fecshoptest.com/ 進入後臺

http://appfront.fecshoptest.com/ 就可以出現fecshop主頁