Pagoda panel deployment front-end and back-end separation project (solve cross-domain problems)

1. Package front-end and back-end projects

Points to note

The joint debugging of the front-end and back-end must be changed to the online address of the front-end and front
-end. Then the database-related matters must be changed to the online database.
Release your own firewall and don’t forget to
open both the Pagoda panel and the Alibaba Cloud server (Tencent Cloud server).

front end

You must change the address you requested.
image.png

Pack

Open packaeg.json and click build

image.png
After packaging, a dist folder will be generated
. Find a directory and put the files in dist below
, but remember what directory you put it in.image.png

Deploy front-end website

Click to add site
image.png

image.png

Solve cross-domain

image.png

#请求中带上/api的都会被转发到我们的后端地址
location /api {
    
    
    add_header 'Access-Control-Allow-Origin' '*';
     #这里是你要代理的地址
    proxy_pass http://120.78.71.148:8080;
}
#加上这句防止我们的页面丢失
  if (!-e $request_filename) {
    
    

    rewrite  ^(.*)$ /index.html?s=/$1  last;

    break;

  }
rear end
How to create a databaseimage.png

Import the data table (you can use navicat to help us import data)

Configure redis (if used in your project)

image.png
If you haven’t downloaded it, download one directly.

redis configuration

image.png

#bind 0.0.0.0
protected-mode no
requirepass yt
Pack

image.png
Put the packaged code in a directory.
It is recommended to put it in the following directory. image.png
Then open the terminal and start it.

Guess you like

Origin blog.csdn.net/SpongeBob_shouse/article/details/128909794