宝塔服务器部署linjiashop前端的过程
admin---------------------------------
1.把项目linjiashop-admin打包:npm run build:prod 打包前需要
npm install --registry=https://registry.npmmirror.com
2.宝塔服务器中新建一个文件夹,把打包好的dist文件夹里面的内容上传
3.修改项目配置文件(后端api项目中配置),原来存在的要适当修改删除(原来的location要删除)
server {
listen 80;
server_name admin.caiyongda.com;
index index.html index.htm default.htm default.html;
root /www/wwwroot/shopStore/admin/;
<-这个location是需要替换原来的->
location /
{
root /www/wwwroot/shopStore/admin-front;
index index.html index.htm;
}
location /prod-api/ {
proxy_pass http://localhost:8082/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#SSL-START SSL相关配置
#error_page 404/404.html;
4.下载项目测试数据的图片:链接:https://pan.baidu.com/s/1i06H4dAM1M7mYQU9etBrfw 提取码:mqvf ,将图片存放到t_sys_cfg表中system.file.upload.path配置的目录下(注意该目录为绝对路径,该目录可以通过“系统管理”-“参数管理”进行配置)
mobile---------------------------------
1.把项目linjiashop-mobile打包:npm run build:prod (需要修改package.json 加上下面的代码)
"scripts": {
"dev": "vue-cli-service serve",
"build": "vue-cli-service build",
"build:prod": "vue-cli-service build",
"lint": "vue-cli-service lint"
},打包前需要 npm install --registry=https://registry.npmmirror.com
2.宝塔服务器中新建一个文件夹,把打包好的dist文件夹里面的内容上传
3.修改项目配置文件(后端api项目中配置),原来存在的要适当修改删除(原来的location要删除)
server
{
listen 80;
server_name caiyongda.com;
index index.html index.htm default.htm default.html;
root /www/wwwroot/shopStore/mobile/;
<-这个location是需要替换原来的->
location /
{
root /www/wwwroot/shopStore/admin-mobile;
index index.html index.htm;
}
location /prod-api/ {
proxy_pass http://localhost:8081/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#SSL-START SSL相关配置
#error_page 404/404.html;