[Linux Server] 4. apache & tomcat connectors 연동
4. apache & tomcat connectors 연동
[root@localhost qual] # tar zxvf tomcat-connectors-1.2.36-src.tar.gz
[root@localhost qual] # cd tomcat-connectors-1.2.36-src/native
[root@www native] # ./configure --with-apxs=/usr/local/src/apache/bin/apxs
[root@www native] # make && make install
[root@www native] # vi /usr/local/src/apache/conf/mod_jk.conf (mod_jk.conf파일 생성)
<IfModule mod_jk.c>
JkWorkersFile “/usr/local/src/apache/conf/workers.properties”
JkLogFile “/usr/local/src/tomcat/logs/mod_jk.log”
JkLogLevel info
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /*.qual ajp13
JkMount /*.admin/* ajp13
JkMount /*.board/* ajp13
JkMount /*.bbs/* ajp13
JkMount /examples/*.jsp ajp13
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]“
JkOptions +ForwardKeySize +ForwardURICompatUnparsed –ForwardDirectories
JkRequestLogFormat "%w %V %T"
</IfModule>
위와 같이 작성하고 저장하고 나온다.
[root@www native] # vi /usr/local/src/apache/conf/workers.properties (workers.properties파일 생성)
#workers.properties
workers.tomcat_home=/usr/local/src/tomcat
workers.java_home=/usr/local/src/java
ps=/
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
위와 같이 작성하고 저장하고 나온다.
[root@www native] # cp /usr/local/src/apache/conf/httpd.conf /usr/local/src/apache/conf/httpd.conf.bak
[root@www native] # vi /usr/local/src/apache/conf/httpd.conf 제일 마지막에 아래와 같이 추가한다.
#mod_jk.so
LoadModule jk_module modules/mod_jk.so
#JK Connection Configuration
include conf/mod_jk.conf
아래 빨간 부분을 추가
#ServerName www.example.com:80을 주석 제거 하고 127.0.0.1 변경
ServerName 127.0.0.1
<IfModule dir_module>
DirectoryIndex index.html index.jsp -> 추가
</IfModule>
#DocumentRoot "/usr/local/src/apache/htdocs"
DocumentRoot "/usr/local/src/tomcat/webapps/ROOT" ----> apache 홈디렉토리를 tomcat 홈디렉토리로 변경
[root@www native] # catalina.sh stop -> start
[root@www native] # apachectl restart
Syntax error on line 2 of /usr/local/src/apache/conf/mod_jk.conf:
JkWorkersFile: Can't find the workers file specified
에러가나오면 위의 mod_jk.conf 파일안에
<IfModule mod_jk.c>
JkWorkersFile “/usr/local/src/apache/conf/workers.properties”
JkLogFile “/usr/local/src/tomcat/logs/mod_jk.log”
JkLogLevel info
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /*.qual ajp13
JkMount /*.admin ajp13
JkMount /*.board ajp13
JkMount /*.bbs ajp13
JkMount /examples/*.jsp ajp13
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompatUnparsed –ForwardDirectories
JkRequestLogFormat "%w %V %T"
</IfModule>
""(쌍따옴표)랑 -(ForwardDirectories 앞 하이픈(-))을 지우고 다시 쓰면 OK!
이렇게 설정하면 http://localhost 하면 localhost:8080 한 것 과 같이 고양이가 나오면 성공!!!
'Linux' 카테고리의 다른 글
[Linux Server] Apache SSL (0) | 2017.12.06 |
---|---|
[Linux Server] 3. tomcat 설치 & /etc/profile 수정 (0) | 2017.10.16 |
[Linux Server] apache 설치 & /etc/profile 수정(gcc 설치 확인) (0) | 2017.10.14 |
[Linux Server] jdk(java) 설치 (0) | 2017.10.12 |
[Linux Server] OpenSSH Source Compile (2) | 2017.10.11 |