vue打包
npm build
生成dist文件夹
go项目打包
go build
最终项目的目录结构
├── dist
│ └── 子目录文件
├── gin-vue-admin
├── config.yaml
nginx配置
server{
listen 80;
server_name gin.admin.com;
location /{
root /Applications/MAMP/htdocs/mygo/src/gin-vue-admin/deplay/dist;
index index.html;
try_files $uri $uri/ /index.html;
}
#通过路由配置进行访问goapi接口
location /api {
proxy_set_header Host $http_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;
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8888;
}
}
网友评论