mobile-tm项目启动配置总结

2018-11-30  本文已影响11人  最近迷茫

1.首先需要检查是否已经安装如下东西:

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.在电脑根目录下创建data/logs/mobile-tm文件夹

4.配置host文件,进入/etc/hosts/,打开hosts文件,将以下东西拷贝(覆盖原内容):

##

# 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执行命令:brew services start nginx。

7.在项目根目录下起redis执行命令:brew services start redis

8.进入asset目录下执行:yarn

9.进入asset目录下react下,先执行yarn,再执行yarn build

10.进入asset目录下static下,先执行yarn,再执行yarn build

11.在react目录下,执行yarn start 

12.在新开窗口下执行命令来起服务:sudo nodemon --watch app server.js

13.在浏览器里打开路径:http://127.0.0.1:9000/

备注:(如果新建文件夹,需要重新在react目录下,执行yarn build)

上一篇下一篇

猜你喜欢

热点阅读