질문&답변
클라우드/리눅스에 관한 질문과 답변을 주고 받는 곳입니다.
리눅스 분류

apache + SSL 설치시 문제점 해결좀..-0-;

작성자 정보

  • 이경록 작성
  • 작성일

컨텐츠 정보

본문

동완님께서 겪으시는 문제가 제가 겪었던 문제랑 흡사하네요 저두 첨에 몰라서 엄청 고생했는데...

안타까운 마음에 혹시 도움이 될까 몇자 적어봅니다..

 

Apache 2.0.59+OpenSSL 0.9.8d 설치하기
1. Installation OpenSSL 0.9.8b (Open Secure Sockets Layer, 암호화 모듈)

# wget http://www.openssl.org/source/openssl-0.9.8d.tar.gz
# tar xvfz openssl-0.9.8b.tar.gz
# cd openssl-0.9.8b
# ./config --prefix=/www/openssl
# make
#make install



2. Installation zlib 1.2.3 (압축 라이브러리)

# wget http://www.zlib.net/zlib-1.2.3.tar.gz
# tar xvfz zlib-1.2.3.tar.gz
# cd zlib-1.2.3
# ./configure --prefix=/www/zlib
# make
# mkdir -p "/www/zlib/include" "/www/zlib/lib"
# make install



3. Installation Apache 2.0.59 (아파치 웹서버)

# wget http://ftp.apache-kr.org/httpd/httpd-2.0.59.tar.gz
# tar xvfz httpd-2.0.59.tar.gz
# cd httpd-2.0.59
# ./configure --prefix=/www/httpd --with-mpm=prefork --enable-ssl --with-ssl=/www/openssl
	      --with-z=/www/zlib --enable-dav --enable-dav-fs --enable-auth-digest --enable-info --enable-rewrite
	      --enable-vhost-alias --enable-expires --enable-mime-magic --enable-so
# make
# make install

아파치의 conf/httpd.conf 파일 수정 - 생략해도 무관

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

아파치가 제대로 작동하는지 확인합니다.
# cd /www/httpd/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: Wed, 07 Jan 2004 01:41:21 GMT
Server: Apache/2.0.48 (Unix) mod_ssl/2.0.48 OpenSSL/0.9.7c DAV/2 
Content-Location: index.html.en
Vary: negotiate,accept-language,accept-charset
TCN: choice
Last-Modified: Fri, 04 May 2001 00:01:18 GMT
ETag: "2801e-5b0-40446f80;28034-961-8562af00"
Accept-Ranges: bytes
Content-Length: 1456
Connection: close
Content-Type: text/html; charset=EUC-KR
Content-Language: en
Expires: Wed, 07 Jan 2004 01:41:21 GMT 

Connection closed by foreign host.
#
설정내용이 적용이안될수 있으므로 리부팅후 다시 로그인하는 것이 가장 확실하다.



4. LibXML 2.6.26 설치 (XML 라이브러리)

# wget ftp://gd.tuwien.ac.at/pub/libxml/libxml2-2.6.26.tar.gz
# tar xvfz libxml2-2.6.26.tar.gz
# cd libxml2-2.6.26/
# ./configure --prefix=/www/libxml
# make
# make install



5. openssl.cnf Configuration (openssl.cnf 설정하기) - 생략해도 무관

# vi /www/openssl/ssl/openssl.cnf
============================================================================
[ req ]
 default_bits            = 1024
 distinguished_name      = req_distinguished_name

[ req_distinguished_name ]
 C                      = 2 letter Country Code, for example US
 C_default              =
 ST                     = State or Province
 ST_default             =
 L                      = City
 L_default              =
 O                      = Organization Name
 O_default              =
 OU                     = Organizational Unit Name, for example 'Marketing'
 OU_default             =
 CN                     = your domain name, for example www.hogwarts.com
 CN_default             =
 emailAddress           = an email address
 emailAddress_default   =
============================================================================





8. Create Certificate Files (인증서 만들기) - 생략해도 무관

① creating the private key name.key
# openssl genrsa -des3 -out name.key 1024

② creating a self-signed certificate name.crt
# openssl req -config ./openssl.cnf -new -key gryffindor.key -x509 -out name.crt

③creating a certificate request name.csr
# openssl req -new -config ./openssl.cnf -key gryffindor.key -out name.csr

④ Testing with the browser

# echo "<%@ page language="java" import="java.util.*" %>" > /www/httpd/htdocs/index.jsp
# echo "<%" >> /www/httpd/htdocs/index.jsp
# echo "String path = request.getContextPath();" >> /www/httpd/htdocs/index.jsp
# echo "String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";" >> /www/httpd/htdocs/index.jsp
# echo "%>" >> /www/httpd/htdocs/index.jsp
# echo "this is my JSP page." >> /www/httpd/htdocs/index.jsp

또는
# vi /www/httpd/htdocs/test.jsp
Secure? <%= request.isSecure() %>

⑤ Creating a certificate chain file
# cat your_domain.crt ComodoSecurityServicesCA.crt GTECyberTrustRoot.crt > chain.txt



9. Add On httpd Service Demon (아파치 데몬 서비스 등록하기) - 생략해도 무관

# cp /www/httpd/bin/apachectl /etc/rc.d/init.d
# cd /etc/rc.d/init.d
# mv apachectl httpd
# vi httpd
	============================================================================
	맨 끝줄에 추가할것
	# chkconfig: 35	77	77
	# description: LDAP stands for Lightweight Directory Access Protocol
	============================================================================

# chkconfig --add httpd

Apache 재시작
# /www/httpd/bin/apachectl stop
# /www/httpd/bin/apachectl startssl
또는
# service httpd startssl
============================================================================

 
 
위 사항에서 아파치는 2.0.59 버전을 사용하였지만 아마 2.2.xx대 버전을 사용해도 무관하리라
생각됩니다.
아! 그리고 아파치 컴파일 하실때..
# ./configure --prefix=/www/httpd --with-mpm=prefork --enable-ssl --with-ssl=/www/openssl --with-z=/www/zlib
옵션들은 꼭 해주시는게 좋구요 --with-ssl=/www/openssl 옵션 때문에 만약 make 시에 에러가 난다면..
--with-ssl=(압축풀어 설치한 원본이 있는 디렉토리) 를 지정해 주시면 됩니다.
부디 좋은 결과 있으시길 바랍니다 ^^

관련자료

댓글 0
등록된 댓글이 없습니다.

공지사항


뉴스광장


  • 현재 회원수 :  60,303 명
  • 현재 강좌수 :  36,970 개
  • 현재 접속자 :  316 명