对应gitee的项目地址: https://gitee.com/qinenqi/https
部署springboot项目
(已经配好了ssl,详情请访问:[添加链接描述]
(https://blog.csdn.net/weixin_41695138/article/details/118963134)):
- 进入centos7,执行以下命令:
cd /root
mkdir java
把打包好的后端jar放入此文件夹(我用的是xftp)
部署vue项目
vue项目打包
- 进入centos7,执行以下命令:
cd /root
mkdir vue
把打包好的vue项目放入此文件夹中
配置nginx
默认已经安装了nginx(并已经安装了ssl模块)服务
nginx配置阿里云的sll请访问: 添加链接描述
- 进入nginx的配置文件(根据nginx的安装时间路径选择进入):vim /usr/local/nginx/conf/nginx.conf,配置80及443端口,
- nginx.conf 配置:
配置 443端口
server {
listen 443 ssl;
server_name manger.csjbot.cn;
root html;
index index.html index.htm;
ssl_certificate /usr/local/nginx/conf/cert/5979386_manger.csjbot.cn.pem;
ssl_certificate_key /usr/local/nginx/conf/cert/5979386_manger.csjbot.cn.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
root /vue/dist/;
index index.html index.htm;
}
}
配置 80 端口转发 443 端口
server {
listen 80;
server_name manger.csjbot.cn;
rewrite ^(.*)$ https://${server_name}$1 permanent;
}
- 启动nginx服务
备注: 我申请的域名是:manger.csjbot.cn
访问页面:
访问nginx 443端口: https://manger.csjbot.cn
访问nginx 80端口: http://manger.csjbot.cn:999 会自动转为443端口上。