vue在history的路由模式下,刷新後界面報404

需要配置下nginx,位置在/conf/vhosts/*.conf,將當前目錄下的所有conf都修改一下最好

server {
        listen        80;
        server_name  agwenbi.vip;
        root   "C:/phpstudy_pro/WWW/agwenbi.vip/iview";
        location / {
            try_files $uri $uri/ @router;
            index index.html;
        }
        location ~ \.php(.*)$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }
        location @router {
            rewrite ^.*$ /index.html last;
        }
gzip  on;
gzip_disable “MSIE [1-6].(?!.*SV1)”;
gzip_http_version 1.1;
gzip_vary on;
gzip_proxied any;
gzip_min_length 5000;
gzip_buffers 16 8k;
gzip_comp_level 6;
gzip_types text/css text/xml text/plain text/javascript application/javascript application/json application/xml application/rss+xml application/xhtml+xml;
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章