PageSourceSearch

https://www.hestudio.net/assets/ruoyi-nginx-404notfound.html-DNU0rzLQ.js

js hestudio.net collected 2026-09-24 10:37:06 UTC 4,849 bytes, 12 lines download raw bytes

1import{_ as t,c as n,f as i,o as a}from"./app-D7CCjthX.js";const s={};function o(p,e){return a(),n("div",null,[...e[0]||(e[0]=[i(`<p>在生产环境部署若依框架前端的时候,会出现前端无法连接到后端,刷新后 404 等情况。</p><figure><img src="https://img.hestudio.net/2025/11/07/690d9c1664a6c.webp" alt="" tabindex="0" loading="lazy"><figcaption></figcaption></figure><figure><img src="https://img.hestudio.net/2025/11/07/690d9c206c91a.webp" alt="" tabindex="0" loading="lazy"><figcaption></figcaption></figure><p>我们在部署的时候只需要在配置文件中(如果使用宝塔面板、1panel 等工具则将其添加到伪静态)添加下面的代码即可。其中,将 <code>http://127.0.0.1:8080/</code>替换为你的后端地址。</p><div class="language-conf line-numbers-mode" data-highlighter="prismjs" data-ext="conf"><pre><code class="language-conf"><span class="line">location / {</span>
2<span class="line">    try_files $uri $uri/ /index.html;</span>
3<span class="line">}</span>
4<span class="line">location /prod-api/ {</span>
5<span class="line">    proxy_set_header Host $http_host;</span>
6<span class="line">    proxy_set_header X-Real-IP $remote_addr;</span>
7<span class="line">    proxy_set_header REMOTE-HOST $remote_addr;</span>
8<span class="line">    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;</span>
9<span class="line"></span>
10<span class="line">    proxy_pass http://127.0.0.1:8080/;</span>
11<span class="line">}</span>
12<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,5)])])}const d=t(s,[["render",o]]),l=JSON.parse('{"path":"/posts/ruoyi-nginx-404notfound.html","title":"若依框架前端nginx伪静态配置","lang":"zh-CN","frontmatter":{"title":"若依框架前端nginx伪静态配置","tag":["运维"],"category":["整活记录"],"description":"在生产环境部署若依框架前端的时候,会出现前端无法连接到后端,刷新后 404 等情况。 我们在部署的时候只需要在配置文件中(如果使用宝塔面板、1panel 等工具则将其添加到伪静态)添加下面的代码即可。其中,将 http://127.0.0.1:8080/替换为你的后端地址。","head":[["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"若依框架前端nginx伪静态配置\\",\\"image\\":[\\"https://img.hestudio.net/2025/11/07/690d9c1664a6c.webp\\",\\"https://img.hestudio.net/2025/11/07/690d9c206c91a.webp\\"],\\"dateModified\\":\\"2025-11-07T07:18:33.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"undefined\\",\\"url\\":\\"https://www.hestudio.net/about/\\",\\"email\\":\\"[email protected]\\"}]}"],["meta",{"property":"og:url","content":"https://www.hestudio.net/posts/ruoyi-nginx-404notfound.html"}],["meta",{"property":"og:site_name","content":"heStudio"}],["meta",{"property":"og:title","content":"若依框架前端nginx伪静态配置"}],["meta",{"property":"og:description","content":"在生产环境部署若依框架前端的时候,会出现前端无法连接到后端,刷新后 404 等情况。 我们在部署的时候只需要在配置文件中(如果使用宝塔面板、1panel 等工具则将其添加到伪静态)添加下面的代码即可。其中,将 http://127.0.0.1:8080/替换为你的后端地址。"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:image","content":"https://img.hestudio.net/2025/11/07/690d9c1664a6c.webp"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2025-11-07T07:18:33.000Z"}],["meta",{"property":"article:tag","content":"运维"}],["meta",{"property":"article:modified_time","content":"2025-11-07T07:18:33.000Z"}]]}
12,"git":{"createdTime":1762499913000,"updatedTime":1762499913000},"readingTime":{"minutes":0.51,"words":153},"filePathRelative":"posts/ruoyi-nginx-404notfound.md","excerpt":"<p>在生产环境部署若依框架前端的时候,会出现前端无法连接到后端,刷新后 404 等情况。</p>\\n<figure><img src=\\"https://img.hestudio.net/2025/11/07/690d9c1664a6c.webp\\" alt=\\"\\" tabindex=\\"0\\" loading=\\"lazy\\"><figcaption></figcaption></figure>\\n<figure><img src=\\"https://img.hestudio.net/2025/11/07/690d9c206c91a.webp\\" alt=\\"\\" tabindex=\\"0\\" loading=\\"lazy\\"><figcaption></figcaption></figure>","autoDesc":true}');export{d as comp,l as data};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.