1. 程式人生 > >resin的配置(如何通過瀏覽器訪問釋出到resin伺服器的html檔案)

resin的配置(如何通過瀏覽器訪問釋出到resin伺服器的html檔案)

本文件不講resin的啟動和關閉,重點分享如何使用resin伺服器,通過瀏覽器訪問自己建立的html檔案。

1.檢視現有配置

開啟resin檔案下的conf資料夾,開啟其中的resin.xml,crtl+F找到下面這段程式碼:

    <host id="" root-directory=".">
      <!--

         - webapps can be overridden/extended in the resin.xml
        -->
      <web-app id="/" root-directory="webapps/ROOT"/>



    </host>

其中,id是主機名,root-directory是你即將通過瀏覽器訪問的html檔案所在的資料夾路徑。

紅色的程式碼行要求你即將通過瀏覽器訪問的html檔案放在webapps/ROOT下才能訪問。

2.開始使用

將即將通過瀏覽器訪問的html檔案(比如new1.html)放在webapps/ROOT下,在瀏覽器中輸入:http://localhost:8080/new1.html 即可訪問。

3.補充

讀者可以自行配置。

例如,我在  <web-app id="/" root-directory="webapps/ROOT"/>這行程式碼下面新增:

<web-app id="/test" root-directory="D:\Program Files (x86)\resin-4.0.51\webapps"/>

接下來將即將通過瀏覽器訪問的html檔案(比如new1.html)放在webapps檔案裡,在瀏覽器中輸入:http://localhost:8080/test/new1.html 即可訪問。

重點是明白resin.xml文件中id和root-directory的含義,這樣才能靈活使用。