블로그 이미지
BJcomm
bjcomm

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

calendar

1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
12-23 07:39

jsp 계정 셋팅과 버추얼호스트 설정

2014. 11. 25. 17:09 | Posted by bjcomm

▶▷ jsp 계정 셋팅과 버추얼호스트 설정 ◁◀

html 폴더에 ROOT, webapps 생성
※ 반드시 폴더 먼저 생성할것
drwxr-xr-x    2 root     root         4096  8월 21 18:52 ROOT
drwxr-xr-x    2 root     root         4096  8월 21 18:52 WEB-INF
drwxr-xr-x    4 root     root         4096  8월 24 19:16 webapps
[root@jsp1 html]# cd webapps
drwxr-xr-x    4 root     root         4096  8월 22 10:18 WEB-INF
drwxrwxrwx    3 root     root         4096 12월 19  2002 manager/web.xml

- 아파치 설정

<VirtualHost 211.110.17.171>
DocumentRoot /free/home/seleven/html
ServerName s11.co.kr
ServerAlias www.s11.co.kr
JkMount /*.jsp ajp13
JkMount /webapps/* ajp13
jkMount /ROOT/* ajp13
JkMount /servlet/* ajp13
JkMount /manager ajp13
JkMount /manager/* ajp13
CustomLog logs/access_log vcommon
</VirtualHost>

- 톰캣 설정
vi /usr/local/jakarta-tomcat/conf/server.xml

      <!--epnosamo.org-->
      <Host name="epnosamo.org" debug="0" appBase="/free/home/ryune/html" unpackWars="true">
        <Context path="/webapps" docBase="webapps" reloadable="true"/>
        <Context path="/ROOT" docBase="ROOT" reloadable="true"/>
        <Context path="/manager" docBase="/free/home/ryune/html/webapps/manager" debug="0" privileged="true"></Context>
        <Alias>www.epnosamo.org</Alias>
       </Host>  
                
      <!--fauction.co.kr-->
      <Host name="fauction.co.kr" debug="0" appBase="/free/home/winbass/html" unpackWars="true">
        <Context path="/webapps" docBase="webapps" reloadable="true"/>
        <Context path="/ROOT" docBase="ROOT" reloadable="true"/>
        <Context path="/manager" docBase="/free/home/winbass/html/webapps/manager" debug="0" privileged="true"></Context>
        <Alias>www.fauction.co.kr</Alias>
       </Host>

    </Engine>

  </Service>

- admin tools manager 설정
vi /usr/local/tomcat/conf/tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="manager"/>
  <role rolename="admin"/>
  <user username="nayana" password="xxxxxx" roles="admin"/>
  <user username="gn5066" password="xxxxx" roles="manager"/>
  <user username="ryune" password="xxxxxx" roles="manager"/>
  <user username="joungjo" password="xxxxx" roles="manager"/>
  <user username="winbass" password="xxxxxx" roles="manager"/>
</tomcat-users>

- admin tools manager 설정후 보안 설정
chmod 400 /usr/local/tomcat/conf/tomcat-users.xml
chown -R gn5066.free /free/home/gn5066/html/webapps/work/gnwater.net/webapps
chown -R ryune.free /free/home/ryune/html/webapps/work/epnosamo.org/webapps
chown -R winbass.free /free/home/winbass/html/webapps/work/fauction.co.kr/webapps

- 서블릿 설정
vi /etc/profile
JAVA_HOME=/usr/local/java
CATALINA_HOME=/usr/local/tomcat
PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
CLASSPATH=.:/usr/local/tomcat/common/lib/servlet.jar   <--- 추가
export JAVA_HOME CATALINA_HOME CLASSPATH

vi /usr/local/jakarta-tomcat/conf/web.xml
    <!-- The mapping for the invoker servlet -->

    <servlet-mapping>
        <servlet-name>invoker</servlet-name>
        <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>


- 톰캣 정지/실행
[root@sph3 bin]# ./shutdown.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JAVA_HOME:       /usr/local/jdk
[root@sph3 bin]# ./startup.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JAVA_HOME:       /usr/local/jdk
[root@sph3 bin]# /etc/rc.d/init.d/tomcat restart|stop|start

▶▷ 자바톰켓 리스트 출력 막는 것과 에러 페이지 지정 ◀

conf/web.xml 에서요

<init-param>
       <param-name>listings</param-name>
       <param-value>false</param-value>
</init-param>

param-value 를 true 에서 false 로 바꾸고 http://okjsp.pe.kr/ 로 들어오면

404 not found 에러 메시지 페이지가 뜨게 됩니다.

그리고 이 404 페이지를 자신이 지정한 페이지로 가게 하려면

/conf/web.xml 에
<error-page>
     <error-code>404<error-code>
     <location>/error.jsp(지정한 페이지)</location>
</error-page>
위에 부분을 추가하시면 됩니다...

jsp 기타 환경설정.