最佳答案
location /自己取个前缀 {
alias /var/www/autotest/fontend/dist; //你的项目
index index.htm index.html;
try_files $uri $uri/ /index.html last;
}
在你的后端nginx中加上去
讨论数量:
location /自己取个前缀 {
alias /var/www/autotest/fontend/dist; //你的项目
index index.htm index.html;
try_files $uri $uri/ /index.html last;
}
在你的后端nginx中加上去
server {
listen 80;
index index.php index.html index.htm default.php default.htm default.html;
server_name home.mychat.cloud;
root 你的dist所在位置;
location /api {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8888; # 设置代理服务器的协议和地址 端口要和后端部署保持一致
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
和gin vue admin 这种框架的部署不是一样

关于 LearnKu
推荐文章: