/etc/nginx/nginx.conf添加这一段

server {
      listen  8090;
      server_name  www.guanacossj.com;
      index index.html;
      root /home/MyBlog/myblogfront/dist;

      location / {
        try_files $uri $uri/ /index.html;
      }
}

root表示vue项目build后生成的dist目录,里面有static和index.html两个文件

在vue工程下,我这里是myblogfront,执行

npm run build

访问ip:8090即可

示例http://101.132.70.184:8090/#/

Logo

前往低代码交流专区

更多推荐