網站首頁 編程語言 正文
方法一
最為簡單的,將router設置為hash模式!!!history模式的路由需要后端配置,hash模式便不需要,不同的框架所需不一樣,看對應的文檔。
方法二
找到nginx配置代碼,進行修改,網上很多都是如下類型的代碼
location ^~ /api { proxy_connect_timeout 600; proxy_read_timeout 600; proxy_set_header x-real-ip $remote_addr; proxy_set_header user-agent $http_user_agent; proxy_set_header connection "keep-alive"; proxy_pass http://127.0.0.1:3000; # 自己需要端口號 }
但是本人親身試過,并沒啥用,因為這個配置的只是請求頭或者超時設置,最重要的卻沒有加上,如下
#重點 配置根目錄的重寫設置 location / { ? ? ? if (!-e $request_filename) { ? ? ? ? ? rewrite ^(.*)$ /index.html?s=$1 last; ? ? ? ? ? break; ? ? ? } ? ? }? location ^~ /api { ? ? ? #以下省略 ? ? }
原文鏈接:https://blog.csdn.net/weixin_44314609/article/details/123548994
相關推薦
- 2022-06-16 C#中執行SQL的幾種方法講解_C#教程
- 2023-03-20 c#中Invoke與BeginInvoke的用法及說明_C#教程
- 2023-01-20 pandas中df.groupby()方法深入講解_python
- 2022-04-15 Python爬蟲之requests庫基本介紹_python
- 2023-01-17 C#?wpf利用附加屬性實現界面上定義裝飾器_C#教程
- 2022-05-14 在Pandas?DataFrame中插入一列的方法實例_python
- 2023-03-17 Android?ViewModel與Lifecycles和LiveData組件用法詳細講解_Andr
- 2021-12-09 Linux環境下安裝JDK1.8_Linux
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支