| @@ -96,4 +96,91 @@ sh ./deploy.sh base | |||
| 刷一下,使之生效:FLUSH PRIVILEGES; | |||
| 退出:exit | |||
| ``` | |||
| 4. 运行modules | |||
| ```shell | |||
| sh ./deploy.sh modules | |||
| ``` | |||
| 5. 运行monitor | |||
| ```shell | |||
| sh ./deploy.sh monitor | |||
| ``` | |||
| 6. 运行前端ui | |||
| 代码下执行`npm install` | |||
| 然后执行 | |||
| ```shell | |||
| npm run dev | |||
| ``` | |||
| 也可以编译后放在nginx中运行 | |||
| ```shell | |||
| npm run build:stage | |||
| 或生产模式编译 | |||
| npm run build:prod | |||
| ``` | |||
| nginx使用docker部署,nginx相关配置如下: | |||
| ```shell | |||
| server { | |||
| listen 81; | |||
| server_name localhost; | |||
| charset utf-8; | |||
| gzip on; | |||
| # 不压缩临界值,大于1K的才压缩,一般不用改 | |||
| gzip_min_length 1k; | |||
| # 压缩缓冲区 | |||
| gzip_buffers 16 64K; | |||
| # 压缩版本(默认1.1,前端如果是squid2.5请使用1.0) | |||
| gzip_http_version 1.1; | |||
| # 压缩级别,1-10,数字越大压缩的越好,时间也越长 | |||
| gzip_comp_level 5; | |||
| # 进行压缩的文件类型 | |||
| gzip_types text/plain application/x-javascript text/css application/xml application/javascript; | |||
| # 跟Squid等缓存服务有关,on的话会在Header里增加"Vary: Accept-Encoding" | |||
| gzip_vary on; | |||
| # IE6对Gzip不怎么友好,不给它Gzip了 | |||
| gzip_disable "MSIE [1-6]\."; | |||
| location / { | |||
| # 不缓存html,防止程序更新后缓存继续生效 | |||
| if ($request_filename ~* .*\.(?:htm|html)$) { | |||
| add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate"; | |||
| access_log on; | |||
| } | |||
| root /home/vctgo/projects/vctgo-ui/xueyi-ui; | |||
| try_files $uri $uri/ /index.html | |||
| index index.html index.htm; | |||
| } | |||
| location /dev-api/ { | |||
| proxy_set_header Host $host; | |||
| proxy_set_header X-Real-IP $remote_addr; | |||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |||
| proxy_pass http://172.17.0.1:8080/; | |||
| proxy_redirect default; | |||
| add_header Access-Control-Allow-Origin *; | |||
| add_header Access-Control-Allow-Headers X-Requested-With; | |||
| add_header Access-Control-Allow-Methods GET,POST,OPTIONS; | |||
| } | |||
| location /stage-api/ { | |||
| proxy_set_header Host $host; | |||
| proxy_set_header X-Real-IP $remote_addr; | |||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |||
| proxy_pass http://172.17.0.1:8080/; | |||
| proxy_redirect default; | |||
| add_header Access-Control-Allow-Origin *; | |||
| add_header Access-Control-Allow-Headers X-Requested-With; | |||
| add_header Access-Control-Allow-Methods GET,POST,OPTIONS; | |||
| } | |||
| error_page 500 502 503 504 /50x.html; | |||
| location = /50x.html { | |||
| root html; | |||
| } | |||
| } | |||
| ``` | |||
| 81端口则为项目的web访问端口 | |||