多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
1. 下载项目 2. 后台app和admin spring boot项目分别打成jar包,上传至服务器指定目录 >java打包跳过测试命令: mvn clean install -Dmaven.test.skip=true 3. 后台vue项目build为静态文件 npm run build:prod,上传至服务器指定目录 4. 运行后台启动脚本 deploy.sh: > 注意:地址要改成自己的 ``` # 检查程序是否在运行 is_exist(){ # 获取PID PID=$(ps -ef |grep ${APP_NAME} | grep -v $0 |grep -v grep |awk '{print $2}') # -z "${pid}"判断pid是否存在,如果不存在返回1,存在返回0 if [ -z "${PID}" ]; then # 如果进程不存在返回1 return 1 else # 进程存在返回0 return 0 fi } # 停止进程函数 stop(){ is_exist if [ $? -eq "0" ]; then kill -9 ${PID} echo "${APP_NAME} process stop, PID=${PID}" else echo "There is not the process of ${APP_NAME}" fi } # 定义启动程序函数 start(){ is_exist if [ $? -eq "0" ]; then echo "${APP_NAME} is already running, PID=${PID}" else nohup java -jar /home/ceres/app/${APP_NAME} --spring.profiles.active=dev > app.log 2>&1 & PID=$(echo $!) echo "${APP_NAME} start success, PID=$!" fi } # 应用名称 APP_NAME=ceres-app-server-1.0.jar echo "======启动=======" cd /home/ceres/app stop start ``` 5. nginx配置 ``` #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 443 ssl; ssl_certificate cert/zkthink.crt; ssl_certificate_key cert/zkthink.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; charset utf-8; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; server_name ceres.zkthink.com; underscores_in_headers on; client_max_body_size 100M; location / { proxy_pass http://localhost:8764/; } location /app/ { proxy_pass http://localhost:8765/app/; } location /ceres-jobs-server/ { proxy_pass http://localhost:8767/ceres-jobs-server/; } location /admin-web { proxy_set_header Host $host:$server_port; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 60; proxy_read_timeout 600; proxy_send_timeout 600; root /home/ceres/ceres-admin-web; index index.html; } location /merchant-web { proxy_set_header Host $host:$server_port; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 60; proxy_read_timeout 600; proxy_send_timeout 600; root /home/ceres/ceres-merchant-web; index index.html; } # 文件访问配置 location ^~ /file { if ($request_uri ~* ^.*\/(.*)\.(apk|java|txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx|jpg|png)(\?fileName=([^&]+))$) { add_header Content-Disposition "attachment;filename=$arg_attname"; } root /home/ceres/upload; index index.html; } } } ```