当前位置:网站首页>egg. JS project deployment online server

egg. JS project deployment online server

2022-07-06 08:29:00 Liu Chu, Ge Nian

First step : Domain name resolution , Create a website
 Insert picture description here
Mount the pagoda , Initializing some software
 Insert picture description here
Then create a website :
 Insert picture description here

The second step : Upload and unzip

The third step : install pm2(node Environmental Science ), Switch node Version to the latest version , install redis

Step four : Open the command line , Switch to the root directory

Step five : If it is a domestic server , Switch the image first :

npm config set registry https://registry.npm.taobao.org

If it is a foreign server, you don't need it , For example, Hong Kong server

Step six : perform npm install

Step seven : Install the database migration tool npm install --save-dev sequelize-cli

Step eight : Modify configuration information :
config/config.default.js

sequelize To configure 
oss To configure 
...

database/config.json

 Database related information 

Step nine : Execute the migration command npx sequelize db:migrate
Step 10 :npm start
Step 11 : Add reverse proxy

Add the configuration :

 location /ws
 {
    proxy_pass http://127.0.0.1:7001;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header X-Real-IP $remote_addr;
 }

Manually add reverse proxy
 Insert picture description here

The twelfth step : Modify the front-end project /common/lib/config.js and manifest.json The domain name inside is ok

原网站

版权声明
本文为[Liu Chu, Ge Nian]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131823348702.html