우리집 개발서버

1. 홈네트워크 현황

2018년 3월말에 처음 HP MicroServer GEN8을 구입하고, 6월 15일을 끝으로 서버에 필요한 부품들을 모두 구매하였습니다.

그간 구매 목록 및 서버 설치 현황

ProLiant 마이크로서버 Gen8
 - CPU : 제온 E3-1265L v2
 - 메모리 : 삼성 8G PC3L-12800E * 2EA
 - SSD : Micron Crucial MX500 500GB
 - HDD : WD 8TB 화이트
 - NIC : Mellanox 10G(MNPA19_XTR)
         Peer To Peer 방식으로 PC와 연결 

VMware 설치
 - Xpenology : DNS, Mail, VPN, NAS 용도로 활용
 - CentOS7 : Apache HTTP Webserver, PHP, MySQL 설치
  . WordPress 설치(www.chohi.ga) - 개인 홈페이지
  . 그누보드 + 아미나빌더 설치(www.duksfarm.ga) - 장인어른 덕이농장 홈

페이지
 - Ubuntu : Atlassian 제품 설치
  . Jira (jira.chohi.ga)
  . Confluence (confluence.chohi.ga)
  . Bitbucket (bitbucket.chohi.ga)

도메인
 - Freenom : 무료

SSL 인증서 
 - Let's Encrypt : 무료

2. Apache HTTP Server SSL 환경

몇일 전에 지인과 얘기도중에 Tomcat에 대해서 의견을 나눈적이 있었습니다.

한참을 Tomcat과 웹서버의 틀린점을 얘기하고 Webserver, WAS서버에 대해 말을했지만… Tomcat은 웹서버라고 하더군요.

결론은 Apache Tomcat과 Apache HTTP Webserver를 구분못하는 분이였습니다.

안타까운 현실은 아직도 Tomcat이 WAS서버라는것을 모르는분이 많이 계십니다.

Webserver와 WAS서버를 구분하기 위해서 VM으로 2개의 서버를 설치하고 아래와 그림처럼 서버를 구성하였습니다.

웹서버 : 192.168.22.11
WAS서버 : 192.168.22.12

WebServer를 통하지 않고 접근하기 위해서는 8080, 8090, 7990 포트포워딩 설정해서 접근이 가능합니다.  

ex) http://www.chohi.ga:8080/  

저는 도메인으로 바로 서비스 하기 원해서 얼굴 마담인 Apache HTTP Webserver에게 DNS를 처리할 수 있도록  아래와 같이 작업을 진행하였습니다.

www.chohi.ga : 192.168.22.11 서버의 wordpress 홈페이지
www.duksfarm.ga : 192.168.22.11 서버의 그누보드+아미나 빌더 홈페이지
jira.chohi.ga : 192.168.22.12 서버의 Jira - 내부 8080 웹포트
confluence.chohi.ga : 192.168.22.12 서버의 Confluence 8090 웹포트
bitbucket.chohi.ga : 192.168.22.12 서버의 Bitbucket 7990 웹포트

Apache HTTP Webserver와 Tomcat서버간의 연계는 mod_jk를 사용하였습니다.

참고 자료도 많고 관리자가 설정할 수 있는 기능이 mod_proxy보다 많다고 합니다.

mod_jk 설정

##CentOS 7
# which apxs
/bin/apxs           <- apxs 파일 위치 확인

##tomcat-connectors 다운로드
#wget http://mirror.apache-kr.org/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.43-src.tar.gz 

# ./configure --with-apxs=/bin/apxs   <- apxs 위치 설정
# make
# make install

httpd.conf 수정(/etc/httpd/conf/)

#VirtialHost 추가

...
NameVirtualHost *:80

<VirtualHost *:80>
  ServerAlias www.chohi.ga
  ServerSignature Off

  <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
  </IfModule>

  ErrorLog /var/log/httpd/redirect.error.log
  LogLevel warn
</VirtualHost>

<VirtualHost *:80>
  ServerName duksfarm.ga
  ServerAlias www.duksfarm.ga
  ServerSignature Off

  <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
  </IfModule>

  ErrorLog /var/log/httpd/redirect.error.log
  LogLevel warn
</VirtualHost>
...

#mod_jk 설정

LoadModule jk_module modules/mod_jk.so

<IfModule mod_jk.c>
  JkWorkersFile conf/workers.properties
  JkLogFile logs/mod_jk_new.log
  JkLogLevel error
  JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
  JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories +ForwardURICompatUnparsed
  JkRequestLogFormat "%w %V %T"
</IfModule>

workers.properties 추가(/etc/httpd/conf/)

worker.list=worker1,worker2,worker3

#JIRA
worker.worker1.type=ajp13
worker.worker1.host=192.168.22.12
worker.worker1.port=8009
#Confluence
worker.worker2.type=ajp13
worker.worker2.host=192.168.22.12
worker.worker2.port=8010
#Bitbucket
worker.worker3.type=ajp13
worker.worker3.host=192.168.22.12
worker.worker3.port=8011

ssl. conf 수정(/etc/httpd/conf.d)

#www.duksfarm.ga

<VirtualHost *:443>
  Header always set Strict-Transport-Security "max-age=31536000; includeSubdomains;"

  # General setup for the virtual host, inherited from global configuration
  DocumentRoot "/home/www/html"

  ...

  CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

  ServerName duksfarm.ga
  Include /etc/letsencrypt/options-ssl-apache.conf
  ServerAlias www.duksfarm.ga
  SSLCertificateFile /etc/letsencrypt/live/duksfarm.ga/cert.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/duksfarm.ga/privkey.pem
  SSLCertificateChainFile /etc/letsencrypt/live/duksfarm.ga/chain.pem
</VirtualHost>

#www.chohi.ga

<VirtualHost *:443>
  Header always set Strict-Transport-Security "max-age=31536000; includeSubdomains;"

  # General setup for the virtual host, inherited from global configuration
  DocumentRoot "/home/www/wordpress"

  ...

  CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

  ServerName chohi.ga
  Include /etc/letsencrypt/options-ssl-apache.conf
  ServerAlias www.chohi.ga
  SSLCertificateFile /etc/letsencrypt/live/chohi.ga/cert.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/chohi.ga/privkey.pem
  SSLCertificateChainFile /etc/letsencrypt/live/chohi.ga/chain.pem
</VirtualHost>

#jira설정

<VirtualHost *:443>
  Header always set Strict-Transport-Security "max-age=31536000; includeSubdomains;"
 
  # is not inherited from httpd.conf.
  ErrorLog logs/ssl_error_log
  TransferLog logs/ssl_access_log
  LogLevel warn

  SSLEngine on

  SSLProtocol all -SSLv2 -SSLv3

  SSLCipherSuite HIGH:3DES:!aNULL:!MD5:!SEED:!IDEA

  BrowserMatch "MSIE [2-5]" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
  CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
  JkMount /* worker1

  ServerName jira.chohi.ga:443
  Include /etc/letsencrypt/options-ssl-apache.conf
  
  SSLCertificateFile /etc/letsencrypt/live/chohi.ga/cert.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/chohi.ga/privkey.pem
  SSLCertificateChainFile /etc/letsencrypt/live/chohi.ga/chain.pem
</VirtualHost>




#confluence설정

...
JkMount /* worker2
...



#bitbucket 설정

...
JkMount /* worker3
...

tomcat 수정(server.xml)

#jira
<Connector port="8009" redirectPort="8443" enableLookups="false" protocol="AJP/1.3" URIEncoding="UTF-8"/>

#confluence  
<Connector port="8010" redirectPort="8443" enableLookups="false" protocol="AJP/1.3" URIEncoding="UTF-8"/>

#bitbucket  <설치된디렉토리>/shared/server.xml
<Connector port="8011" redirectPort="8443" enableLookups="false" protocol="AJP/1.3" URIEncoding="UTF-8"/>

Apache HTTP WebServer 재기동

#service httpd restart

https://www.chohi.ga
https://www.duksfarm.ga
https://jira.chohi.ga 
https://confluence.chohi.ga 
https://bitbucket.chohi.ga 

다음 서버설정할때 고생하지 않도록 설정한 내용을 남겨둡니다.

You May Also Like

About the Author: chohi

익명에 답글 남기기 응답 취소

이메일 주소는 공개되지 않습니다.