vue单页面部署nginx配置

   server {
       listen       80 default_server;
       listen       [::]:80 default_server;
       server_name  _;
       #vue目录
       root         /opt/dist;
      index  index.html;
       # Load configuration files for the default server block.
       include /etc/nginx/default.d/*.conf;

   location / {
           #所有路径进入index
            try_files $uri $uri/ @router;
            index index.html;
        }

       location @router {
           rewrite ^.*$ /index.html last;
       }

       error_page 404 /404.html;
           location = /40x.html {
       }

       error_page 500 502 503 504 /50x.html;
           location = /50x.html {
       }

原文链接:https://blog.csdn.net/qq_32448349/java/article/details/88994611

你可能感兴趣的:(vue单页面部署nginx配置)