본문 바로가기

WEB & WAS/Apache

[Apache] http2 적용

반응형

개요

http2 프로토콜이 2015년에 나왔음에도 아직까지 대부분의 웹사이트들은 HTTP/1.1을 사용중에 있다.  포털, 검색 같은 큰 사이트들은  이미 http2로 전환이 완료되었거나 진행중임을 알 수 있다. apache에서 http2 설치 및 적용방법에 대해서 알아보도록 하자.

구성 환경

http-2.4.41 / cent os 7.6 / openssl 1.0.2

 

HTTP/2는 TLS위에서 동작하는 h2와 cleartext TCP 위에 동작하는 h2c로 나뉘게 된다. 대부분 우리가 사용하는 웹브라우저(IE,Crome,Firefox...)등은 TLS위에서 동작하는 h2만을 지원한다. h2c를 지원하는 것은 curl 등이 있다. h2는 TLS 1.2이상에서 작동한다.

1. 설치 준비

 1.1 apache에서 http2 모듈(mod_http2.so)은 libnghttpd, libnghttpd2-devel 라이버러리를 필요로함으로 설치

 1.2 openssl 1.0.2 부터는  ALPN지원, 브라우저의 경우 ALPN을 지원하지 않으면 HTTP/2 통신을 하지 않고 HTTP/1.1 으로 강제 통신을한다. 

 * ALPN(Application-Layer Protocol Negotiation) :  HTTP/2을 사용하기 위한 TLS의 확장 프로토콜 규약

 

2. apache 컴파일

shell> ./configure --prefix=/usr/local/httpd2  --enable-so -enable-ssl --enable-http2

shell> make

shell> make install

 

3. apache 환경 설정

 3.1. httpd.conf 에서  3개의 모듈 및 ssl Include 주석 제거

LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule ssl_module modules/mod_ssl.so 
LoadModule http2_module modules/mod_http2.so
Include conf/extra/httpd-ssl.conf


 3.2. httpd.conf 에서 http2 프로토콜 활성화

<IfModule http2_module> 
  ProtocolsHonorOrder On
  Protocols h2 h2c http/1.1
</IfModule>

 3.3. ssl 설정

>>>>> Apache SSL 인증서 설치 참조 <<<<<

반응형

'WEB & WAS > Apache' 카테고리의 다른 글

debian Apache Reverse Proxy 설정  (0) 2021.10.31
[Apache] SSL 인증서 설치  (0) 2019.11.22