宝塔部署
准备文件:
surveyking-xxx.zip,前端文件surveyking-server.jar,后端 jar 包surveyking-pro.sql,数据库脚本
安装宝塔

安装软件环境
可以直接从宝塔的软件商店里面选择要安装的软件
- ① 安装 Java
- ② 安装 Redis
- ③ 安装 Mysql
- ④ 安装 Nginx
安装 Java
宝塔软件商店里面没有 jdk,我们需要先安装 Tomcat,安装 Tomcat 会自动下载 jdk。

据提示安装 Tomcat,安装 Tomcat 的时候如果没有安装 JDK 就会自动安装一个 JDK,例如:选择 Tomcat8 -->默认会安装一个 JDK 1.8.0_121。

安装完 Tomcat 之后,服务会自动开启,我们不需要 Tomcat 服务,可以直接关掉。

安装 Redis

安装 Mysql
安装 Mysql(>=5.7 都可以) 数据库,最好选择 8.0 版本


安装 Nginx

安装卷王系统
新建数据库
安装完成数据库之后,需要先初始化 root 账号的密码

创建数据库

导入 sql 脚本


安装前目录配置
主要有三个目录:
- 解压
surveyking-xxxx.zip,会生成一个 dist 目录 - 创建一个
files目录,用来存储系统上传的附件 surveyking-server.jar,后端 jar 包

安装后端
选择完 jar 包和端口号之后,在后面添加数据库的配置
注意
-- 前面必须得有空格,将 数据库名 和 数据库密码 替换成新建数据库时的数据库名和密码
# 部署后端
--spring.datasource.dynamic.datasource.master.url=jdbc:mysql://127.0.0.1:3306/数据库名 --spring.datasource.dynamic.datasource.master.username=root --spring.datasource.dynamic.datasource.master.password=数据库密码

安装前端


配置代理,点击设置,打开左侧的配置文件,在倒数第二行(上面红框处)添加如下内容,注意修改端口号和前端 dist 目录路径 并保存
# 将 /www/wwwroot/surveyking/dist 替换为实际前端 dist 目录。
# 直访入口 HTML 时也必须禁用缓存,避免版本更新后继续加载旧 chunk 列表。
location = /pub/index.html {
root /www/wwwroot/surveyking/dist/public;
etag off;
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
add_header X-Version $date_gmt always;
add_header Vary "Accept-Encoding" always;
try_files /index.html =404;
}
location = /adm/index.html {
root /www/wwwroot/surveyking/dist/admin;
etag off;
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
add_header X-Version $date_gmt always;
add_header Vary "Accept-Encoding" always;
try_files /index.html =404;
}
# 答题入口构建资源,对应 Umi publicPath=/pub/。
# 文件名带 hash,可以长缓存;不使用 always,避免 404 响应被浏览器长缓存。
location ^~ /pub/ {
alias /www/wwwroot/surveyking/dist/public/;
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable";
add_header Vary "Accept-Encoding" always;
try_files $uri =404;
}
# 后台入口构建资源,对应 Umi publicPath=/adm/。
location ^~ /adm/ {
alias /www/wwwroot/surveyking/dist/admin/;
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable";
add_header Vary "Accept-Encoding" always;
try_files $uri =404;
}
# 答题、练习、公开查询、兑换页面走 public 入口。
location ~ ^/(e|s|t|q|redeem)(/|$) {
root /www/wwwroot/surveyking/dist/public;
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
add_header X-Version $date_gmt always;
add_header Vary "Accept-Encoding" always;
try_files /index.html =404;
}
# 登录注册绑定同时被答题和后台使用,线上优先返回 public 入口。
location ~ ^/user/(login|register|binding)/?$ {
root /www/wwwroot/surveyking/dist/public;
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
add_header X-Version $date_gmt always;
add_header Vary "Accept-Encoding" always;
try_files /index.html =404;
}
# 二维码代理
location /captcha {
# 给端口 1991 改成安装后端时的端口
proxy_pass http://localhost:1991/captcha;
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
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_set_header X-Forwarded-Proto $scheme;
client_max_body_size 30m;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_send_timeout 1800;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
}
# 后端接口代理
location /admin-api {
# 给端口 1991 改成安装后端时的端口
proxy_pass http://localhost:1991/admin-api;
proxy_buffering off;
proxy_cache off;
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
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_set_header X-Forwarded-Proto $scheme;
client_max_body_size 30m;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_send_timeout 1800;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
}
# 兼容旧版文件访问路径。
location /files {
# 给端口 1991 改成安装后端时的端口
proxy_pass http://localhost:1991/files;
set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
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_set_header X-Forwarded-Proto $scheme;
client_max_body_size 30m;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_send_timeout 1800;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
}
# 健康检查。
location /health {
access_log off;
return 200 "healthy\n";
add_header Content-Type text/plain;
}
# 其它前端路由走后台入口。
location / {
root /www/wwwroot/surveyking/dist/admin;
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
add_header X-Version $date_gmt always;
add_header Vary "Accept-Encoding" always;
try_files $uri $uri/ /index.html;
}
安装后配置
基础配置
可以设置是否开启注册,是否开启登录验证码,默认都开启

配置文件服务
配置系统附件存储路径和访问路径
提示
注意,自定义域名必须设置为当前系统的访问地址

配置微信公众号
公众号设置
设置完公众号之后: ① 可以通过公众号登录系统;② 可以限制微信答卷并且问卷内开启微信答题次数限制

配置 Ocr
配置完成之后,可以开启身份证号 Ocr 识别
