Deploy the React project on the Web front-end to a Linux server
The directory structure of the project
1 ```2 ├─dlls #dlls编译后的问题3 ├─doc #帮助文件入口4 │5 ├─src6 │├─apps #各个功能模块放在这里7 ││├─aftersale #售后模块8 │││└─contractmanage #合同管理9 │││└─componentTen ││├─login One ││├─sales A││|├─housequery -││|└─reservation -│|├─action.js #主界面可发起动作 the│|├─index.js #主界面视图, connected redux -│|└─reducer.js #主界面动作处理器 - │├─common #公共资源文件夹, including functional style pictures, etc. - ││└─img + ││├─funbutton - ││└─icons + │├─components #可复用视图组件, no strong correlation with specific business A ││├─common at ││├─footer - ││├─leftpanel #左侧菜单 - ││├─loding - ││├─navpath #面包屑 - ││├─panelbox - ││├─rightpanel #右侧主视图区 in ││└─tabpanel - │├─constants #公用静态数据 to│|└─leftmenu #主菜单结构定义 (Add a menu here when adding a new module) + │├─entries #系统主入口文件 - │├─reducers #系统动作处理器注册模块 (Add new module to add action processor here) the │├─routes #系统路由动态生成模块 (based on the module structure under apps) * │├─store #系统全局状态存储器 (generally not modified) $ ││└─middlewaresPanax Notoginseng │└─util #工具类包 (xfetch background Request tool, etc.) - │ the ├─static #静态资源存放路径 +```
I. Editing a configuration file
Modify the file
Projectname\server\config\environment\common.js
Process.env.NODE_ENV = ' development '| | ' Server IP '//8001, 9092
Two. Packaging procedures
Under the project root path
NPM Run Build
Client appears
Package the client and server
TAR-ZCVF client.tar.gz Client
TAR-ZCVF server.tar.gz Server
Three. Uploading and booting
Copy the Client.tar.gz,server.tar.gz,theme.js,package.json four files to the project folder on the server
Enter the project directory to open the service
cnpm installpm2 Server/app.js
In this way, the project is deployed to the server.
Deploy the React project on the Web front-end to a Linux server