当前位置:网站首页>Project deployment (simplified version)
Project deployment (simplified version)
2022-07-23 11:05:00 【Qingchi】
Deployment of front-end projects , And deployment of backend projects

Front end deployment server : Nginx
Back end deployment server : Tomcat( Embedded )

On the server A(192.168.*.*) Install in Nginx, Upload the front-end packaged files to Nginx Of html Under the table of contents
modify Nginx The configuration file nginx.conf
take nginx.conf In profile , Put the original monitor 80, 82, 8080 Port number Comment out the virtual host of , Introduce the following configuration information :
server {
listen 80;
server_name localhost;
location / {
root Own page ;
index Page name .html;
}
location ^~ /api/ {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://192.168.*.*:8080;
}
location = /50x.html {
root html;
}
}adopt nginx Visit front end Engineering
192.168.*.*
Reverse agent configuration
After the deployment of front-end engineering , We can normally access the login page of the system , Click the login button , You can see the request initiated by the server

/api This prefix passes without modifying the server code nginx Can easily solve this problem
This configuration represents , If the request is currently nginx, And if the requested path is /api/ start , Will be location Handle . And location in , Two pieces of information are mainly configured : rewrite(url rewrite ) and proxy_pass( Reverse proxy ). Next, let's analyze the configuration of these two items .
rewrite ^/api/(.*)$ /$1 break; Here is a regular expression , If the request path is /api/ start , The following request path is arbitrary , The original url The path is rewritten as /$1, there $1 It refers to wildcards .* The content of this piece . such as :
/api/employee/login ------> ^/api/(.*)$ -------->
here (.*) The match is employee/login ------>
Finally rewritten as /$1 : /employee/loginReverse proxy
proxy_pass http://192.168.138.101:8080;On the server B(192.168.*.*1) Install in jdk、git、maven、MySQL, Use git clone The order will git Clone the code from the remote warehouse
confirm jdk: java -version
confirm git:git -version
confirm maven:mvn -v
Push the developed code to the remote warehouse , And on the server B Clone it from
# establish java Code storage directory
mkdir -p /usr/local/javaapp
# Toggle directory
cd /usr/local/javaapp
# Cloning code , You need to use your own remote warehouse
git clone https://gitee.com/**/***.git We can go through ps -ef|grep java Instructions , Check whether the service is started .
Execute the script
#!/bin/sh
echo =================================
echo The automated deployment script starts
echo =================================
echo Stop the original running project
APP_NAME=**********
tpid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Stop Process...'
kill -15 $tpid
fi
sleep 2
tpid=`ps -ef|grep $APP_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Kill Process!'
kill -9 $tpid
else
echo 'Stop Success!'
fi
echo Ready to go from Git The warehouse pulls the latest code
cd /usr/local/javaapp/*****
echo Start from Git The warehouse pulls the latest code
git pull
echo Code pull complete
echo Start packing
output=`mvn clean package -Dmaven.test.skip=true`
cd target
echo Start project
nohup java -jar *********.jar &> *****.log &
echo Project start up complete
Picture display problem handling
Modify the file storage directory :path: /usr/local/img/
Put the local test image folder img( Whole folder ) Upload to server B Of /usr/local Under the table of contents
Then you can access the address of the main database and come out successfully
边栏推荐
- Heidelberg CP2000 circuit board maintenance printer host controller operation and maintenance precautions
- 疫情时期加中年危机——游荡在十字街口的三个月
- Compare the advantages and disadvantages of RDB and AOF modes of redis
- 项目部署(简版)
- 3DMAX first skin brush weights, then attach merge
- Déploiement du projet (version abrégée)
- 单点登录-认证服务器与客户端的session过期时间如何统一
- Detailed explanation of structure
- "The six programming languages I want most!"
- Redis源码与设计剖析 -- 8.对象系统
猜你喜欢
随机推荐
支付宝DTS架构
CountDownLatch的用法
遇到了ANR错误
Single sign on - how to unify the expiration time of session between authentication server and client
开发必备之Idea使用
Data Lake: introduction to delta Lake
Redis源码与设计剖析 -- 5.整数集合
Thing JS notes
PMP practice once a day | don't get lost in the exam -7.22
Redis源码与设计剖析 -- 8.对象系统
Cadence (IX) 17.4 rules and spacing settings
【信息系统项目管理师】第六章 复盘进度管理知识架构
9、光线追踪
项目部署(简版)
8. Surface geometry
海德堡CP2000电路板维修印刷机主机控制器操作及保养注意事项
Activiti工作流使用之Activiti-app的安装及流程创建
[visual slam] orb slam: tracking and mapping recognizable features
sort
Activiti工作流使用之流程结构介绍









