์น ์๋ฒ๊ฐ ํน์ ๋๋ ํ ๋ฆฌ ๋ด์ ํ์ผ ๋ชฉ๋ก์ ๋ธ๋ผ์ฐ์ ์ ๋ ธ์ถํ๋ '๋๋ ํ ๋ฆฌ ๋ฆฌ์คํ ' ์ทจ์ฝ์ ์ ํด๊ฒฐํ๊ธฐ ์ํ WebSphere ์ค์ ๊ฐ์ด๋์ ๋๋ค. ์ ํ๋ฆฌ์ผ์ด์ ๋ ๋ฒจ(xml) ์์ ๋ฐฉ์๊ณผ ๊ด๋ฆฌ ์ฝ์(Admin Console)์ ํตํ ์ ์ญ ์ค์ ๋ฐฉ์์ ๋ค๋ฃน๋๋ค.
0. ๋ฐฐ๊ฒฝ ๋ฐ ์์ธ (Context)
๋๋ ํ ๋ฆฌ ๋ฆฌ์คํ ์ด ํ์ฑํ๋์ด ์์ผ๋ฉด ๊ณต๊ฒฉ์๊ฐ ์๋ฒ์ ๋๋ ํ ๋ฆฌ ๊ตฌ์กฐ์ ํ์ผ ๋ชฉ๋ก(๋ฐฑ์ ํ์ผ, ์์ค ์ฝ๋ ๋ฑ)์ ํ์ ํ ์ ์์ด 2์ฐจ ๊ณต๊ฒฉ์ ๋น๋ฏธ๊ฐ ๋ฉ๋๋ค.
WebSphere๋ ์ ์ ํ์ผ ์ฒ๋ฆฌ๋ฅผ ์ํ fileServingEnabled ์์ฑ๊ณผ ๋ชฉ๋ก ๋
ธ์ถ์ ์ํ directoryBrowsingEnabled ์์ฑ์ ๊ฐ์ง๊ณ ์์ผ๋ฉฐ, ์ด๋ฅผ ์ ์ ํ ์ ์ดํด์ผ ํฉ๋๋ค.
Test Environment
- OS: CentOS 7.2
- Web Server: IBM HTTPServer v8.5.0.0
- WAS: WebSphere Application Server v8.5
1. Method A: ์ ํ๋ฆฌ์ผ์ด์ ์ค์ ํ์ผ ์์
๊ฐ๋ณ ์ ํ๋ฆฌ์ผ์ด์ ๋จ์๋ก ์ค์ ์ ์ ์ฉํ ๋ ์ฌ์ฉํฉ๋๋ค. WAR/EAR ํ์ผ ๋ด๋ถ์ IBM ํ์ฅ ์ค์ ํ์ผ์ ์ง์ ์์ ํฉ๋๋ค.
์ค์ ํ์ผ ๋์
- WAS v7.0 ์ด์:
ibm-web-ext.xml - WAS v6.1 ์ดํ:
ibm-web-ext.xmi(Legacy)
์ค์ ๋ด์ฉ (ibm-web-ext.xml)
enable-directory-browsing ์์ฑ์ false๋ก ๋ช
์ํฉ๋๋ค.
<?xml version="1.0" encoding="UTF-8"?>
<web-ext
xmlns="http://websphere.ibm.com/xml/ns/javaee/web-ext/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee/web-ext/1.0 http://websphere.ibm.com/xml/ns/javaee/web-ext/1.0/web-ext.xsd">
<!-- ์ ์ ํ์ผ ์๋น ํ์ฑํ (์ด๋ฏธ์ง, HTML ๋ฑ) -->
<enable-file-serving value="true"/>
<!-- ํต์ฌ: ๋๋ ํ ๋ฆฌ ๋ฆฌ์คํ
๋นํ์ฑํ -->
<enable-directory-browsing value="false"/>
</web-ext>
2. Method B: ์น ์ปจํ ์ด๋(Web Container) ์ ์ญ ์ค์
WAS ๊ด๋ฆฌ ์ฝ์์์ ์๋ฒ ๋จ์๋ก ์์ฑ์ ์ถ๊ฐํ์ฌ ์ ์ดํ๋ ๋ฐฉ์์ ๋๋ค. ์ ํ๋ฆฌ์ผ์ด์ ์ ์ฌ๋ฐฐํฌํ์ง ์๊ณ ์ค์ ์ ๋ณ๊ฒฝํ ์ ์์ด ์ด์ ํ๊ฒฝ์์ ์ ํธ๋ฉ๋๋ค.
์ค์ ๊ฒฝ๋ก
์๋ฒ(Servers) > ์๋ฒ ์ ํ(Server Types) > WebSphere application servers > [์๋ฒ๋ช
] > ์น ์ปจํ
์ด๋ ์ค์ (Web Container Settings) > ์น ์ปจํ
์ด๋(Web container) > ์ฌ์ฉ์ ์ ์ ํน์ฑ(Custom properties)
์ฃผ์ ์์ฑ ๊ฐ
์๋ ์์ฑ์ ์๋ก ์์ฑ(New)ํ์ฌ ์ถ๊ฐํฉ๋๋ค.
| ์ด๋ฆ (Name) | ๊ฐ (Value) | ์ค๋ช |
|---|---|---|
| directoryBrowsingEnabled | false | ๋๋ ํ ๋ฆฌ ๋ชฉ๋ก ์กฐํ ๊ธฐ๋ฅ์ ๋นํ์ฑํํฉ๋๋ค. (๋ณด์ ํ์) |
| fileServingEnabled | true | WAS๊ฐ ์ ์ ํ์ผ(html, img ๋ฑ)์ ์ฒ๋ฆฌํ ์ง ์ฌ๋ถ์ ๋๋ค. (false ์ค์ ์ ์ ์ ํ์ผ ์ฒ๋ฆฌ๊ฐ ๋ถ๊ฐํ ์ ์์) |
fileServingEnabled๋ฅผ false๋ก ์ค์ ํ๋ฉด ๋๋ ํ ๋ฆฌ ๋ฆฌ์คํ
๋ ์ฐจ๋จ๋์ง๋ง, WAS๊ฐ ์ด๋ฏธ์ง๋ CSS ๊ฐ์ ์ ์ ๋ฆฌ์์ค๋ฅผ ์ ํ ์ ๊ณตํ์ง ์๊ฒ ๋๋ฏ๋ก ์ฃผ์๊ฐ ํ์ํฉ๋๋ค. ์ผ๋ฐ์ ์ผ๋ก๋ directoryBrowsingEnabled๋ง false๋ก ์ค์ ํฉ๋๋ค.
3. ๊ฒ์ฆ (Verification)
- ์ค์ ์ ์ฉ ํ WAS ์ธ์คํด์ค๋ฅผ ์ฌ๊ธฐ๋ํฉ๋๋ค.
- ๋ธ๋ผ์ฐ์ ์์
index.html์ด ์๋ ๋๋ ํ ๋ฆฌ ๊ฒฝ๋ก(์:http://domain/images/)๋ก ์ ์ํฉ๋๋ค. - 403 Forbidden ์๋ฌ๊ฐ ๋ฐ์ํ๋ฉด ๋ณด์ ์ค์ ์ด ์ ์์ ์ผ๋ก ์ ์ฉ๋ ๊ฒ์ ๋๋ค.