[Project Deployment Combat] - Server Pagoda deploys SpringBoot project and Vue project and sets proxy

One article realizes zero foundation from packaging to project deployment and operation, a small white version.

Preparation

  1. java : SpringBoot project package (jar, war)
  2. Front end: static html, js, css
  3. Database: related data services and initialization sql code of the project database

pick a server

Tencent cloud-light cloud server-2G 2-core 40GBSSD+ pagoda image used

Enter the pagoda panel

  1. Install Nginx 1.22.1
  2. MySQL 5.7.40
  3. Tomcat 7.0.108 (including JDK environment)

Package SpringBoot project

insert image description here
Run mvn-package:
insert image description here
a jar package will appear in the target directory at this time:
insert image description here
test whether the jar package can run normally:
insert image description here
test:
http://localhost:9010/druid/index.html

Package the front-end project

  1. Determine whether the proxy proxy address is written to the backend port
    insert image description here
  2. Run under the project path
npm run build

insert image description here
insert image description here

Deploy back-end and front-end code to run on the server

Service deployment diagram:
insert image description here

Implement backend deployment

premise:

  1. JDK: The jdk version of the server should be the same as the jdk version used when we develop and compile. If it is inconsistent: the 8 server used for development can use 9\10; if the development and compilation use version 10+, the server must use 10 ~version 11
  2. Install the compatible version of mysql used during development: use MySQL5.5- for development, and the server can only use Mysql7.1-; use MySQL5.6+ for development, and use Mysql8+ casually for the server (time format, data engine, foreign key constraint automatic generate idkey)

1. Upload the jar package to the server

Upload the jar package packaged by SpringBoot
insert image description here
Upload the file in the dist directory packaged by vue (static+index.html)
insert image description here

2. Publish SpringBoot service

insert image description here
insert image description here
Because the backend runs on port 9010, the firewall policy of Tencent Cloud Platform needs to pass port 9010
insert image description here

3. Publish the front end

insert image description here
insert image description here
Now test whether the front end can access:
insert image description here

When requesting the interface, it is found that the front-end proxy policy does not take effect.
insert image description here
Set the reverse proxy:
insert image description here
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/gjb760662328/article/details/130221200