1.首先需要檢查是否已經(jīng)安裝如下東西:
node 飒货、nodemon 感凤、yarn丸相、nginx、redis竟秫。
如沒有則按如下命令相應安裝:
npm install n -g
npm install -g nodemon
npm install yarn -g
brew install nginx
brew install redis
2.將config文件拷貝至根目錄下
3.在電腦根目錄下創(chuàng)建data/logs/mobile-tm文件夾
4.配置host文件娃惯,進入/etc/hosts/,打開hosts文件,將以下東西拷貝(覆蓋原內(nèi)容):
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.? Do not change this entry.
##
255.255.255.255 broadcasthost
::1? ? ? ? ? ? localhost?
0.0.0.0 account.jetbrains.com
# 127.0.0.1 devm.iqdnet.com
127.0.0.1 qatm.iqdnet.com
127.0.0.1 devtm.iqdnet.com
# 10.37.251.63 devpatrol.qdingnet.com
# 10.37.251.63nbetaac.qdingnet.com
5.配置nginx,進入/usr/local/etc/nginx/肥败,打開nginx.conf,將以下東西拷貝:
user? root staff;
worker_processes? 1;
events {
? ? worker_connections? 1024;
}
http {
? ? include? ? ? mime.types;
? ? default_type? application/octet-stream;
? ? sendfile? ? ? ? on;
? ? keepalive_timeout? 65;
? ? server {
? ? ? ? listen? ? ? 80;
? ? ? ? server_name front.qdingnet.com devfront.qdingnet.com qafront.qdingnet.com;
? ? ? ? #access_log? ? /var/log/nginx/access.log;
? ? ? ? #error_log? ? /var/log/nginx/error.log;
? ? ? ? autoindex on;
? ? ? ? add_header Access-Control-Allow-Origin 'qdingnet.com';
? ? ? ? location /public/ {
? ? ? ? ? ? alias /Users/yong/qd/front/public/;
? ? ? ? ? ? index index.html;
? ? ? ? }
? ? ? ? location /polymer/ {
?? ? ? ? ? ? alias /Users/yong/qd/front/polymer/;
?? ? ? ? ? ? index index.client.html index.html;
? ? ? ? }
? ? ? ? location /saas-web/ {
?? ? ? ? ? ? alias /Users/yong/qd/saas/;
? ? ? ? }
? ? ? ? location / {
? ? ? ? ? ? rewrite ^/([\w-]+)/(.*)$ /$1/temp/$2 break;
? ? ? ? ? ? root /Users/yong/qd/front/;
? ? ? ? }
? ? }
? ? server {
? ? ? listen? 80;
? ? ? server_name? m2.iqdnet.com qam.iqdnet.com devm.iqdnet.com;
? ? ? access_log /data/logs/devm-access.log;
? ? ? error_log /data/logs/devm-error.log;
? ? ? add_header Access-Control-Allow-origin *;
? ? ? add_header Access-Control-Allow-Methods 'GET, POST';
? ? ? location / {
? ? ? ? proxy_pass http://127.0.0.1:9000;
? ? ? }
? ? }
? ? server {
? ? ? listen? 80;
? ? ? server_name? qatm.iqdnet.com devtm.iqdnet.com;
? ? ? location / {
? ? ? ? proxy_pass http://127.0.0.1:9001;
? ? ? }
? ? }
? ? server {
? ? ? listen? 80;
? ? ? server_name? qafm.iqdnet.com;
? ? ? location / {
? ? ? ? proxy_pass http://127.0.0.1:9002;
? ? ? }
? ? }
? ? server {
? ? ? listen? 80;
? ? ? server_name? devb.qdingnet.com;
? ? ? access_log? ? /var/log/nginx/access.log;
? ? ? error_log? ? /var/log/nginx/error.log;
? ? ? location / {
? ? ? ? proxy_pass http://127.0.0.1:9003;
? ? ? }
? ? }
? ? server {
? ? ? listen? 80;
? ? ? server_name? bigdata.qdingnet.com;
? ? ? location / {
? ? ? ? proxy_pass http://127.0.0.1:3000;
? ? ? }
? ? }
}
6.在項目根目錄下起nginx執(zhí)行命令:brew services start nginx趾浅。
7.在項目根目錄下起redis執(zhí)行命令:brew services start redis
8.進入asset目錄下執(zhí)行:yarn
9.進入asset目錄下react下愕提,先執(zhí)行yarn,再執(zhí)行yarn build
10.進入asset目錄下static下皿哨,先執(zhí)行yarn浅侨,再執(zhí)行yarn build
11.在react目錄下,執(zhí)行yarn start?
12.在新開窗口下重新回到根目錄執(zhí)行命令來起服務(wù):sudo nodemon --watch app server.js
13.在瀏覽器里打開路徑:http://127.0.0.1:9000/
備注:(如果新建文件夾证膨,需要重新在react目錄下如输,執(zhí)行yarn build)
QA測試賬號:18811111119/111119