(중략) # 다음 줄의 주석제거 NameVirtualHost * # 아래 단락은 원래의 설정을 가상호스트 항목으로 # 다시 한 번 적어준 것이다. 아래 단락이 없으면 # 서버 홈페이지 (HHHHHH.snu.ac.kr) 로 접속을 해도 # 본인의 개인 홈페이지로 접속되어 버리는 해괴망칙한 # 사태가 발생한다. -_-; 원래 설정이 따로 있는데 # 반영이 안 되는 이유는 모르겠음. <VirtualHost *> ServerAdmin kmscom@HHHHHH.snu.ac.kr DocumentRoot "/usr/local/apache/htdocs" ServerName HHHHHH.snu.ac.kr Alias /cgi-bin/ "/usr/local/apache/cgi-bin/" ErrorLog /usr/local/apache/logs/error_log CustomLog /usr/local/apache/logs/access_log common </VirtualHost> # 아래 단락은 www.gypark.pe.kr 로 접속했을 때 <VirtualHost *> ServerAdmin gypark@HHHHHH.snu.ac.kr # DocumentRoot 를 내 홈페이지로 지정 DocumentRoot /export/home/lab/gypark/public_html # ServerName 을 지정 ServerName www.gypark.pe.kr # cgi-bin 디렉토리는 별도로 지정해야 한다. Alias /cgi-bin/ "/export/home/lab/gypark/public_html/cgi-bin/" # 로그 화일도 별도로 지정 ErrorLog logs/www-gypark.pe.kr-error_log CustomLog logs/www-gypark.pe.kr-access_log common </VirtualHost> # 아래 단락은 www 없이 내ID.pe.kr 로 접속했을 때.. # 두 단락을 하나의 단락으로 적어 줄 수는 없을런지.. <VirtualHost *> # 아래줄을 제외한 나머지는 위의 경우와 동일하므로 생략 ServerName gypark.pe.kr </VirtualHost>
/usr/local/apache/bin/apachectl restart 경우에 따라서 /etc/init.d/apache restart
Let's encrypt에서 발급해준다는 공짜 인증서를 받아 나도 HTTPS를 지원하겠다...고 맘 먹었는데,
certbot 이란 걸 쓰면 편하다는데 이게 centos5 에서는 이런 저런 의존성 해소가 안 되어 중간에 실패함ㅠ
https://github.com/Neilpang/acme.sh - bash 스크립트만으로 해결되는 다른 클라이언트
git clone https://github.com/Neilpang/acme.sh.git cd ./acme.sh ./acme.sh --install # 여기까지 하면 /root/.acme.sh 아래에 필요한 게 이것저것 생겨있음 acme.sh --issue --apache -d gypark.pe.kr -d www.gypark.pe.kr # /root/.acme.sh/gypark.pe.kr/ 아래에 .cer, .key 등의 파일이 생김 acme.sh --install-cert -d gypark.pe.kr \ --cert-file /etc/httpd/ssl/gypark.pe.kr-cert.pem \ --key-file /etc/httpd/ssl/gypark.pe.kr-key.pem \ --fullchain-file /etc/httpd/ssl/letsencrypt.pem \ --reloadcmd "service httpd graceful" # /etc/httpd/ssl 아래에 키가 생성됨
이제 아파치 설정 수정
NameVirtualHost *:443 <VirtualHost *:443> DocumentRoot /home/gypark/public_html ServerName gypark.pe.kr Alias /cgi-bin /home/gypark/public_html/cgi-bin CustomLog /var/log/httpd/access_log_gypark.pe.kr combined ErrorLog /var/log/httpd/error_log_gypark.pe.kr # SSL 설정 SSLEngine on # SSLProtocol -all +TLSv1.2 # centos5의 openssl 버전이 낮아서 TLS 1.2를 못 씀... SSLCertificateFile /etc/httpd/ssl/gypark.pe.kr-cert.pem SSLCertificateKeyFile /etc/httpd/ssl/gypark.pe.kr-key.pem SSLCertificateChainFile "/etc/httpd/ssl/letsencrypt.pem" SSLCACertificatePath "/etc/httpd/ssl/" SSLCACertificateFile "/etc/httpd/ssl/letsencrypt.pem" </VirtualHost>
수정 후 아파치 재시작: service httpd graceful
그런데 계속 /etc/httpd/conf.d/ssl.conf 에 있는 _default_:443 의 virtual host 설정이 우선시되어서, 인증서가 올바르지 않다고 나옴. 별 수 없이 그 블록을 주석처리해줌.
일단 https://gypark.pe.kr 로 접속할 수 있는 것은 확인을 했는데, 크롬은 TLS 버전이 낮다며 계속 콘솔에 경고문을 띄운다. 아무래도 서버를 신버전으로 업그레이드하기 전에는 https 로만 쓰기는 무리일 듯.