日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > vue >内容正文

vue

vue部署问题

發布時間:2023/12/10 vue 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vue部署问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

history模式配置后刷新404的解決辦法!

第一種 nginx配置? ? ?

在usr/local/nginx/conf/vhost 下 域名.conf配置文件修改或添加

第一種方案

server {##在server下添加或在location里面添加以下代碼location / {if (!-e $request_filename) {rewrite ^(.*)$ /index.html?s=$1 last;break;}}## 如果訪問的不是根目錄用下面方式設置 qiancheng是我的子目錄location /qiancheng{if (!-e $request_filename) {rewrite ^/(.*) /qiancheng/index.html last;break;}}}
第二種方案
location / {try_files $uri $uri/ /index.html; }
?

第二種??Apache

<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.html$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.html [L] </IfModule>

第三種?原生 Node.js

const http = require('http') const fs = require('fs') const httpPort = 80http.createServer((req, res) => {fs.readFile('index.htm', 'utf-8', (err, content) => {if (err) {console.log('We cannot open "index.htm" file.')}res.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'})res.end(content)}) }).listen(httpPort, () => {console.log('Server listening on: http://localhost:%s', httpPort) })

第四種  Firebase 主機

在你的 firebase.json 中加入: {"hosting": {"public": "dist","rewrites": [{"source": "**","destination": "/index.html"}]} }

第五種?tomcat的配置

添加 WEB-INF文件夾web.xml文件 加入下列代碼:

<web-app>
  <error-page>
    <error-code>404</error-code>
    <location>/index.html</location>
  </error-page>
</web-app>

參考文件

https://router.vuejs.org/zh/guide/essentials/history-mode.html#%E5%90%8E%E7%AB%AF%E9%85%8D%E7%BD%AE%E4%BE%8B%E5%AD%90

轉載于:https://www.cnblogs.com/miaoyiyan/p/9635566.html

總結

以上是生活随笔為你收集整理的vue部署问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。