One article realizes zero foundation from packaging to project deployment and operation, a small white version.
Preparation
- java : SpringBoot project package (jar, war)
- Front end: static html, js, css
- 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
- Install Nginx 1.22.1
- MySQL 5.7.40
- Tomcat 7.0.108 (including JDK environment)
Package SpringBoot project
Run mvn-package:
a jar package will appear in the target directory at this time:
test whether the jar package can run normally:
test:
http://localhost:9010/druid/index.html
Package the front-end project
- Determine whether the proxy proxy address is written to the backend port
- Run under the project path
npm run build
Deploy back-end and front-end code to run on the server
Service deployment diagram:
Implement backend deployment
premise:
- 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
- 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
Upload the file in the dist directory packaged by vue (static+index.html)
2. Publish SpringBoot service
Because the backend runs on port 9010, the firewall policy of Tencent Cloud Platform needs to pass port 9010
3. Publish the front end
Now test whether the front end can access:
When requesting the interface, it is found that the front-end proxy policy does not take effect.
Set the reverse proxy: