Skip to content

前端部署文档

easyink edited this page Aug 24, 2022 · 1 revision

使用nginx服务部署前端项目

  1. 使用dokcer部署一个nginx服务(https://blog.csdn.net/cool_summer_moon/article/details/106470037)
  2. 使用命令npm run build将前端项目进行打包
  3. 将打包后的dist文件夹下的文件放入nginx下
  4. 配置nginx的conf配置文件
gzip  on;
gzip_min_length  100k;
gzip_buffers     4 16k;
gzip_http_version 1.1;
gzip_comp_level 6; #压缩等级,号量不多并发小的客户可以使用6,号量多并发高的客户使用1
gzip_types       text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php application/javascript;
gzip_disable "MSIE [1-6]\.";

# 配置easyink_system的服务地址
upstream api{
  server 127.0.0.1:32093 weight=1 fail_timeout=2s max_fails=2;
}

server {
    listen       80;
    server_name  127.0.0.1;
    client_max_body_size  50m;
    location / {
      root /app/dist;
      index  index.html index.htm;
    }
    location /api/ {
      proxy_pass http://api/;
      proxy_http_version 1.1;
      index  index.html index.htm;
    }
    location /profile {
      proxy_pass  http://api;
      proxy_http_version 1.1;
      proxy_connect_timeout 1;
      proxy_send_timeout 30;
      proxy_read_timeout 60;
      proxy_buffering off;
    }
}
  1. 启动服务,并为该服务绑定一个域名地址。(注意:easyink_Dashboard、easyink_System、easyink_Sidebar三个服务的域名地址需要为同一个)

推荐使用jenkins进行持续集成

Clone this wiki locally