programing

IIS 서버에서 Vue 2 애플리케이션을 구성하는 방법

randomtip 2022. 7. 11. 22:36
반응형

IIS 서버에서 Vue 2 애플리케이션을 구성하는 방법

IIS 서버 구성 및 Vue 2 응용 프로그램에 대한 도움이 필요합니다. 방금 설치했습니다.vue 2 application을 기반으로 하여Windows IIS 7 server, 모두 정상적으로 동작하고 있습니다.단, 동작하지 않는 것은 다음과 같습니다.링크를 사용하여 페이지를 열려고 하면 "example mysite.com/somepage"그것은 vue-been으로 쓰여져 있다.404 error메뉴 링크를 클릭하면 정상적으로 동작합니다.메인 URL mysite.com만 입력하면 열립니다만, 그 외의 루트는 동작하지 않습니다.

httpRedirect 같은 것을 설정해야 할 것 같아요!

당신의 정보에 따르면, 제 생각에 당신은 그 약품들을history사용중인 모드는 다음과 같습니다.여기서 참조해 주세요.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Handle History Mode and custom 404/500" stopProcessing="true">
            <match url="(.*)" />
            <conditions logicalGrouping="MatchAll">
              <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
              <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            </conditions>
          <action type="Rewrite" url="index.html" />
        </rule>
      </rules>
    </rewrite>
      <httpErrors>     
          <remove statusCode="404" subStatusCode="-1" />                
          <remove statusCode="500" subStatusCode="-1" />
          <error statusCode="404" path="/survey/notfound" responseMode="ExecuteURL" />                
          <error statusCode="500" path="/survey/error" responseMode="ExecuteURL" />
      </httpErrors>
      <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

vue-router 매뉴얼에 기재되어 있듯이 이력 모드를 사용하려면 다음 작업을 수행해야 합니다.

  1. IIS UrlRewrite 를 인스톨 합니다.
  2. web.config 파일을 프로젝트의 루트에 드롭합니다.web.config 파일의 예는 vue-router 설명서를 참조하십시오.

언급URL : https://stackoverflow.com/questions/45778566/how-to-config-vue-2-application-on-iis-server

반응형