若依分离版本+Nginx+docker+jenkins 部署
准备:
jenkins
node.js
若依前后分离
docker
最终访问地址:
服务端api地址:192.168.66.74:8086
前端页面地址:192.168.66.61:7001
jenkins先配置nodejs
然后新建一个自由风格的软件项目,配置如下
项目Dockerfile文件配置
项目default.conf配置
user root; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; charset utf-8; location / { #静态页面目录 root /usr/share/nginx/html/; try_files $uri $uri/ /index.html; index index.html index.htm; } #服务端反向代理配置 location /stage-api/ { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #服务端地址 proxy_pass http://192.168.66.74:8086/; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
其中/stage-api/ 这个一定要和打包时候对应的环境对应上
打包前vue.js配置文件一定要写对服务器地址
解决若依部署出现:Error: Cannot find module ‘xxxx‘
参考:https://blog.51cto.com/YangRoc/5057163?b=totalstatistic