RSS구독하기:SUBSCRIBE TO RSS FEED
즐겨찾기추가:ADD FAVORITE
글쓰기:POST
관리자:ADMINISTRATOR

Apache 2.0.48 + tomcat5.0.14 + PHP 5.0.0 + SSL + PERL


========================================================================================

출처 : KLTP 신현진님 게시물 (http://kltp.kldp.org/stories.php?story=03/11/13/6851865&topic=2)

========================================================================================

Apache 2.0.48 Tomcat 5.0.14 Alpha mod_jk2 2.0.2 mod_perl2 PHP 5.0.0 Beta2 For Solaris
이 자료는 KLTP에 제가 올린 자료에 SSL 설정 부분을 추가한 업데이트된 문서입니다. 많은 도움이 되시길 바랍니다.

설치전 준비물
J2SE
Apache
Tomcat
Tomcat-Connector(mod_jk2)
mod_perl
openssl
PHP
zlib
/dev/random
libxml

이외에도 GNUtar, libtool, autoconf, automake 등이 없다면 다운로드 받으시기 바랍니다.

설치에 필요한 파일 다운로드 사이트

J2SE
1.4.2-b28 j2sdk-1_4_2-nb-3_5_1-bin-sol-sparc.bin http://java.sun.com/j2se/
apache
2.0.48 httpd-2.0.48.tar.gz http://httpd.apache.org/
tomcat
5.0.14 Alpha jakarta-tomcat-5.0.14.tar.gz http://jakarta.apache.org/site/binindex.cgi
tomcat-connectors
jk2-2.0.2
(mod_jk2 2.0.2) jakarta-tomcat-connectors-jk2.0.2-solaris8-apache2.0.43.tar.gz http://jakarta.apache.org/builds/
mod_perl
1.99_11 mod_perl-2.0-current.tar.gz http://perl.apache.org/
openssl
0.9.7c openssl-0.9.7c.tar.gz http://www.openssl.org/
PHP
5.0.0. Beta2 php-5.0.0b2.tar.gz http://www.php.net/
zlib
1.1.4 zlib-1.1.4.tar.gz http://www.gzip.org/zlib/
/dev/random
0.7
Solaris 8 ANDIrand-0.7-5.8-sparc-1.pkg http://www.cosy.sbg.ac.at/~andi/SUNrand/
libxml
2.6.1 libxml2-2.6.1.tar.gz http://xmlsoft.org/

위 사이트의 주소가 틀릴수도 있습니다. 대부분은 http://sunfreeware.com/ 에 가시면 다운로드 받을 수 있습니다. 참고하세요.
설치 중 에러가 나는 경우는 필요한 프로그램이 없는 경우 또는 버전이 맞지 않아서 일수도 있으며, 환경변수가 잡혀 있지 않거나, 퍼미션 설정이 잘 못 되었거나, 오타일 가능성을 살펴 봅니다. 에러 메시지를 잘 보시고 대처하시기 바랍니다.

J2SE Install
telnet console에서 인스톨하고자 하시는 분은 -console 혹은 -silent 옵션을 이용하세요.

# chmod 755 j2sdk-1_4_2-nb-3_5_1-bin-sol-sparc.bin
# ./j2sdk-1_4_2-nb-3_5_1-bin-sol-sparc.bin


저는 인스톨을 /usr/local/java 디렉토리에 하고, 패스를 잡아주었습니다.
설치후 버전을 확인하세요.

# cd /usr/local/java/bin
#./java -version



openssl 설치
# cd /tmp
# tar zxvf openssl-0.9.7c.tar.gz
# cd openssl-0.9.7c/
# ./config --prefix=/www/openssl
# make
# make install



zlib 설치
# cd /tmp/
# tar zxvf zlib-1.1.4.tar.gz
# cd zlib-1.1.4/
# ./configure --prefix=/www/zlib
# make
# mkdir -p "/www/zlib/include" "/www/zlib/lib"
# make install



/dev/random 설치
# su -
# umask 022
# pkgadd -d ANDIrand-0.7-5.8-sparc-1.pkg



apache 설치
# cd /tmp # tar zxvf httpd-2.0.48.tar.gz
# cd httpd-2.0.48/
# ./configure --prefix=/www/httpd --with-mpm=prefork --enable-ssl?--with-ssl=/www/openssl --enable-deflate --with-z=/www/zlib --enable-dav --enable-dav-fs --enable-auth-digest --enable-info --enable-rewrite --enable-vhost-alias --enable-expires --enable-mime-magic
# make
# make install


아파치의 conf/httpd.conf 파일 수정

# cd /www/httpd/conf
# vi ./httpd.confe Servername localhost:80 (여기 localhost는 자신의 도메인에 맞게 수정)
User nobody 라인 밑에 한줄 추가
-> Group nobody
# Group #-1
AddDefaultCharSet EUC-KR 로 수정

아파치가 제대로 작동하는지 확인합니다.
# cd /www/apache/bin
# ./apachectl start
#
# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.1 200 OK
Date: Thu, 13 Nov 2003 02:37:16 GMT
Server: Apache/2.0.48 (Unix) mod_ssl/2.0.48 OpenSSL/0.9.7c DAV/2
Accept-Ranges: bytes
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=EUC-KR

Connection closed by foreign host.
#



libxml 설치
# cd /tmp/
# tar zxvf libxml2-2.6.1.tar.gz
# cd libxml2-2.6.1/
# ./configure --prefix=/www/libxml
# make
# make install



PHP 설치
# cd /tmp/
# tar zxvf php-5.0.0b2.tar.gz
# cd php-5.0.0b2/

주의) --without-gd : gd 라이브러리를 사용하지 않도록 하는 옵션.
Solaris의 경우 gd 라이브러리가 설치되어 있지 않거나 설치되어 있다고 해도 자꾸 에러가 나서 저 옵션을 사용했습니다.
LINUX에서는 사용하지 않아도 에러 없이 컴파일 할 수 있습니다
# ./configure --prefix=/www/httpd/php --with-mysql=/usr/local/mysql \
--with-apxs2=/www/httpd/bin/apxs --with-exec-dir=/www/httpd/php/bin \
--enable-track-vars --with-config-file-path=/www/httpd/conf \
--with-libxml-dir=/www/libxml --with-mod-charset --with-language=korean \
--with-charset=euc_kr --enable-versioning --without-gd2

# make
# make install
# cp php.ini-dist /www/httpd/php/lib/php.ini


/www/httpd/conf/httpd.conf 를 vi로 열어 아래 부분을 추가합니다.

LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps


아파치를 실행시켜 PHP와 연동이 되었는지 확인합니다

# cd /www/apache/bin
# ./apachectl restart
#
# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.1 200 OK
Date: Thu, 13 Nov 2003 03:37:45 GMT
Server: Apache/2.0.48 (Unix) mod_ssl/2.0.48 OpenSSL/0.9.7c DAV/2 PHP/5.0.0b2
Accept-Ranges: bytes
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=EUC-KR

Connection closed by foreign host.
#



mod_jk2 연동(복사)
이 부분에서 저는 소스를 컴파일 하지 않고 이미 솔라리스용으로 만들어진 so 파일을 이용했습니다
아파치 2.0.43용으로 만들어 졌지만 이번 설치에 사용한 2.0.47과도 호환이 됩니다.
소스컴파일보다 훨씬 쉽게 아파치-톰캣 연동 완료

# cd /tmp/
# tar zxvf jakarta-tomcat-connectors-jk2.0.2-solaris8-apache2.0.43.tar.gz
# cd jakarta-tomcat-connectors-jk2.0.2-solaris8-apache2.0.43/
# cp mod_jk2-2.0.43.so /www/httpd/modules/



tomcat 설치
# cd /www
# tar zxvf jakarta-tomcat-5.0.7.tar.gz
# mv jakarta-tomcat-5.0.7/ tomcat/




tomcat 환경설정

1./www/tomcat/conf/server.xml 을 아래와 같이 설정





description="User database that can be updated and saved">



factory
org.apache.catalina.users.MemoryUserDatabaseFactory


pathname
conf/tomcat-users.xml




timestamp="true"/>


directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true"/>





2.conf/jk2.properties 에 한줄만 있으면 됩니다.
# cat /www/tomcat/conf/jk2.properties
channelSocket.port=8009



3./www/httpd/conf/workers2.properties 파일이 없으므로 아래를 복사하여 만듭니다
# cat /www/httpd/conf/workers2.properties
[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
tomcatId=localhost:8009
[uri:/tomcat-docs/*]
[uri:/jsp-examples/*]
[uri:/servlets-examples/*]
[shm:]
disabled=1



4./www/httpd/conf/httpd.conf 파일에 다음 한줄을 추가합니다
mod_jk2 를 Load 하도록...(물론 mod_jk2-2.0.43.so 파일을 mod_jk2.so 로 이름을 바꾸어 사용해도 된다.)
LoadModule jk2_module modules/mod_jk2.0.43.so


5. 디렉토리 퍼미션을 적절하게 조정해 준다.이외에 다른 디렉토리 퍼미션도 조정할 필요가 있으면 한다.

# cd /www/tomcat/
# chown -R tomcat:user logs/ work/



tomcat 과 아파치를 실행해서 연동이 되었는지 확인해 봅니다.
# su - tomcat
# cd /www/tomcat/bin
# ./catalina.sh start
# su -
# cd /www/apache/bin
# ./apachectl start


# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.1 200 OK
Date: Thu, 13 Nov 2003 02:43:29 GMT
Server: Apache/2.0.48 (Unix) mod_ssl/2.0.48 OpenSSL/0.9.7c DAV/2 PHP/5.0.0b2 mod_jk2/2.0.2
Accept-Ranges: bytes
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=EUC-KR

Connection closed by foreign host.
#


적절히 연동이 되었는지 아래 주소로 확인해 봅니다
doc :
http://localhost/tomcat-docs/


JSP :
http://localhost/jsp-examples/


Servlet :
http://localhost/servlets-examples/

서비스를 멈춥니다

# su -
# cd /www/apache/bin
# ./apachectl stop
# su - tomcat
# cd /www/tomcat/bin
# ./catalina.sh stop



mod_perl 설치
# cd /tmp/
# tar zxvf mod_perl-2.0-current.tar.gz
# cd mod_perl-1.99_09/
# perl Makefile.PL MP_AP_PREFIX=/www/httpd MP_INST_APACHE2=1
# make
# make install


conf/httpd.conf 를 수정하여 아파치 시작시 모듈이 올라오도록 수정합니다

LoadModule perl_module modules/mod_perl.so

아파치를 실행시켜 mod_perl 과 Perl 버전이 뜨는지 확인합니다

# cd /www/apache/bin
# ./apachectl restart
#
# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.1 200 OK
Date: Thu, 13 Nov 2003 02:45:52 GMT
Server: Apache/2.0.48 (Unix) mod_perl/1.99_09 Perl/v5.8.0 mod_ssl/2.0.48 OpenSSL/0.9.7c DAV/2 PHP/5.0.0b2 mod_jk2/2.0.2
Accept-Ranges: bytes
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=EUC-KR

Connection closed by foreign host.
#


SSL 설치 및 가동

# cd /www/openssl/bin
Random State생성
# openssl sha1 * > rand.dat or
cat file1 file2 file3 > rand.dat or
생성하지 않아도 됨


개인키 생성.

# openssl genrsa -rand rand.dat -des 1024 > key.pem
키를 생성하기위해서 rand.dat를 난수생성을 위해 로드하고, DES로 암호화하여 1024bit 의 RSA 알고리즘을 사용하여 생성된 결과값을 파일 key.pem에 출력합니다.
# openssl genrsa -rand rand.dat -des3 1024 > key.pem
( triple DES로 개인키를 암호화하길 원할 경우)
주의:passphase를 기억해야 합니다.Apache-SSL서버 시작시 passphase가 반드시 필요하기 때문입니다.


CSR 생성

#>openssl req -new -key key.pem -out csr.pem
인증서버에 보낼 파일을 생성했다.
위에서 생성한 전자서명키와 다음에 입력할 DN(distinguish name) 정보를 가지고 인증요청정보(CSR.PEM)을 생성합니다
1. C (country : 국가) 에 해당하는 값을 입력합니다.
(예) KR : Korea (mandatory)
2. ST (state : 지방) 에 해당하는 값을 입력합니다
(예) New South Wales = NSW
3. L (locality : ) 에 해당하는 값 (city, town 등) 을 입력합니다.
4. DN 에 해당하는 O(organization) 의 이름을 기입합니다. 이 NAME은 도메인 NAME의 일부로 사용하게 됩니다..
예) KICA : Korea Information Certificate Authority (mandatory)
5. DN에 해당하는 회사이름 OU(organization unit)을 입력합니다.
(예) KR, Dacom 등
6. Web Server의 FULL 도메인 name 또는 IP를 입력합니다.. 이것은 당신이 차후 사용하게 될 web site 의 https URL로 사용할 수 있도록 합니다.
(예) www. Bookstore.com or 128.134.254.166
7.남은 attribute 부분은 생략해도 됩니다.
8.위 과정을 거치면 다음과 같은 csr.pem 형식의 web server 인증요청 정보가 나오게 됩니다.



CSR 보기

# cat csr.pem
-----BEGIN CERTIFICATE REQUEST-----
MIIB3zCCAUgCAQAwgZ4xCzAJBgNVBAYTAktSMQ4wDAYDVQQIEwVTZW91bDEfMB0G
A1UEBxMWam9vbmdyaW0tZG9uZyxjaHVuZy1ndTENMAsGA1UEChMES0lDQTEUMBIG
A1UECxMLbGljZW5zZWRXZWIxFzAVBgNVBAMTDnd3dy5zaWducmEuY29tMSAwHgYJ
KoZIhvcNAQkBFhFraWNhQHNpZ25nYXRlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOB
jQAwgYkCgYEAwV7RJqGC9M0OGEiCRsszrXNa2uu1tJ+oqtIbmG5lzyLcpYPV0JOb
o6vQq27RP2EbEHoUNLL92oWNlKwo/kkUoR9r3TvjhZ221uFoGjBt/LSwn9ui3nY+
Ntef90l24ltNpc7eHPNnvTdWLWWmkO9EImJ90soc0VTqwSORfxGd4KVqzH17U5yQ
/m3W
-----END CERTIFICATE REQUEST-----


이 pem 형식의 인증요청정보(CSR)를 복사하여 웹서버 인증 발급요청에서 인증서 요청 정보란에cut & paste후 나머지 정보를 입력한 뒤 인증서 발급 요청을 하면 됩니다.
http://www.crosscert.com 에서 테스트 인증서를 받을 수 있습니다



인증서 설치

1. SSL 인증서 설정( SSLCertificateFile )
공인인증기관으로부터 cut&paste한 PEM 형식의 인증서를 웹서버에 파일로 저장한다. (인증서를 /www/httpd/conf 에 파일로 저장한 경우)

#vi httpd.conf
#Point SSLCertificateFile at a PEM encoded certificate.
# If the certificate is encrypted, then you will be prompted for a pass phrase.
# Note that a kill -1 will prompt again.
# A test certificate can be generated with "make certificate".
SSLCertificateFile /www/httpd/conf/cert.pem


2. SSL 전자서명 생성키 설정( SSLCertificateKeyFile )
# 개인키 생성시 생성했던 전저서명생성키를 설정하는 것으로 절대패스를 지정해주어야 하고 만약 암호화되어 있다면 웹서버 기동시 암호를 입력을 요구한다.


#vi httpd.conf
# If the key is not combined with the certificate, use this directive to
# point at the key file. If this starts with a '/' it specifies an absolute
# path, otherwise it is relative to the default certificate area. That is, it
# means "/private/".
SSLCertificateKeyFile /www/httpd/conf/key.pem



SSL 설치 완료 & 웹서버 시작

# cd /www/httpd/bin
# ./apachectl start ssl
Apache/2.0.48 mod_ssl/2.0.48 (Pass Phrase Dialog)
Some of your private key files are encrypted for security reasons.
In order to read them you have to provide us with the pass phrases.

Server localhost:443 (RSA)
Enter pass phrase: (password 입력)

Ok: Pass Phrase Dialog successful.



이 문서에 대한 저작권은 없습니다. 마음껏 활용하셔도 됩니다.
하지만, 이 문서에 대한 책임은 지지 않습니다. 문의나 메일은 사양합니다.
저처럼 1주일씩 삽질하시는 분들을 위해 만들어 보았습니다.
참고로 이 자료는 http://www.parupunte.com/minaken/apache2/httpdtomcat507modjk2.html 사이트의 자료를 토대로 작성 했습니다.
 

이올린에 북마크하기
2007/04/24 16:50 2007/04/24 16:50
http://jiny.kr/trackback/34
전체 (406)
지니소식 (4)
자료실 (4)
정보|뉴스 (5)
SmartPhone (1)
Languages (206)
Server (153)
Database (27)
Design (4)
Gallery (0)
분류하기귀찬.. (2)
«   2012/02   »
      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      
  1. 창의력과 상상력을 넘어서  2009
    Tomcat 6.0 기본 환경 설정
  2. 닥공  2009
    서블릿 tomcat 6.0 실행시 에러
  1. 2010/07 (1)
  2. 2010/05 (1)
  3. 2010/02 (3)
  4. 2010/01 (3)
  5. 2009/05 (2)
Statistics Graph