網站首頁 編程語言 正文
方法一
最為簡單的,將router設置為hash模式?。。istory模式的路由需要后端配置,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-07-06 C語言深入探究水仙花數與變種水仙花數代碼_C 語言
- 2022-06-06 Python實現為PDF去除水印的示例代碼_python
- 2023-10-14 SQL Server 執行sql報錯'sys.sp_OACreate' 的訪問
- 2022-05-04 ?分享Python?中的?7?種交叉驗證方法_python
- 2022-12-31 解決React報錯`value`?prop?on?`input`?should?not?be?nul
- 2022-05-28 C語言數據結構深入探索順序表_C 語言
- 2023-07-27 react中使用echarts
- 2022-08-01 Flask-Sqlalchemy的基本使用詳解_python
- 最近更新
-
- 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同步修改后的遠程分支