본문으로 바로가기

curl 설치 및 http2 적용

category 서버 & 시스템/Linux 2018. 4. 17. 15:52
반응형



SPDY ( Stream Control Transmission Protocol )

HTTP/2 로 전환 되기 전 google 이 진행했던 웹 가속 프로토콜로 https 기반의 프로토콜 서비스로 현재는 HTTP/2에 흡수되어 개발이 종료 되었음.

SPDY 지원 가능 브라우져 사용율( 77.39% ) ( 2016년에 chrome에서 지원 제거될 예정 )

 

HTTP/2 ( HyperText Transfer Protocol 2 )

프로토콜 선언 h2, h2c 가 존재함 ( 좀더 확장 가능성 있음 )

h2의 경우 https 프로토콜 http/1.1 을 http/2 프로토콜로 사용이 가능

h2는 SSL인증서를 통한 TLS 암호화를 통해 헤더를 압축 전송한다.


단점

브라우져 지원에 차이가 있음 (h2 HTTP/2 지원 가능 브라우져 사용률 = 70.15%)

Internet Explorer 11 지원 (윈도우 10만 지원)

EDGE 지원

EDGE mobile 지원

Firefox 36이상

Firefox for Android 45이상

Chrome 41이상

Chrome for android 49 이상

Safari(OSX 10.11) 9 이상

Safari(iOS) 9.2이상

Opera Software Opera 28 이상

Opera Software Opera mobile 36 이상


결론

보편적 HTTPS 서비스가 된다는 조건하에 구현 가능( let’s encrypt )

 

h2c의 경우 http 프로토콜 http/1.1 을 http/2 프로토콜로 전환 가능

h2c는 인증서없이 보편적 웹 프로토콜을 목표로 하기 때문에 base64로 압축 전송을 한다.

단점 : 지원하는 브라우져가 현재(2016-04-07) 없음

결론 : 구현 방법이 쉽지만 지원하는 브라우져가 없음 (현재 curl 7.43 버전 지원 )

 

아파치 2.4.17 버전 부터 DSO 모듈로( mod_http2.so ) HTTP/2를 지원 한다.









설치환경

OS : Centos 6.9

apache: 2.43




1. 라이브러리 설치

# yum groupinstall "Development Tools"

# yum install libev libev-devel zlib zlib-devel openssl openssl-devel git 




2. nghttp2 설치

# cd /usr/local/src

# wget  https://github.com/nghttp2/nghttp2

# cd nghttp2

# autoreconf -i

# automake

# autoconf

# ./configure // ./configure --prefix=/usr/local/nghttpx --enable-app \\ ./configure로 설치함

# make && make install


* 오류발생

**오류**

# autoreconf -i

configure.ac:727: error: Autoconf version 2.64 or higher is required \\ autoconf 2.64 이상의 버전을 요구

m4/ax_check_compile_flag.m4:60: AX_CHECK_COMPILE_FLAG is expanded from...

configure.ac:727: the top level

autom4te: /usr/bin/m4 failed with exit status: 63

aclocal: autom4te failed with exit status: 63

autoreconf: aclocal failed with exit status: 63 



**해결방법**

autoconf 업그레이드


# autoconf --version

autoconf (GNU Autoconf) 2.63 \\ 기존의 autoconf 2.63 버전

Copyright (C) 2008 Free Software Foundation, Inc.

License GPLv2+: GNU GPL version 2 or later

<http://gnu.org/licenses/old-licenses/gpl-2.0.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.


# cd /usr/local/src

# mv /usr/bin/autoconf /usr/bin/autoconf_2.63 \\ 기존의 autoconf 2.63 버전 백업

# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz

# tar xvfvz autoconf-2.69.tar.gz

# cd autoconf-2.69

# ./configure

# make &&  make install


# /usr/local/bin/autoconf --version

autoconf (GNU Autoconf) 2.64 \\ 새로 설치한 autoconf 2.64 버전

Copyright (C) 2009 Free Software Foundation, Inc.

License GPLv2+: GNU GPL version 2 or later

<http://gnu.org/licenses/old-licenses/gpl-2.0.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.


# cp -arp /usr/local/bin/autoconf /usr/bin/autoconf 




3. curl 설치 및 nghttp2 컴파일

# mv /usr/bin/curl /usr/bin/curl_ori \\ 기존 설치된 curl 이동

# cd /usr/local/src

# wget http://curl.haxx.se/download/curl-7.46.0.tar.gz 

# tar zxvf curl-7.46.0.tar.gz 

# cd curl-7.46.0

# ./configure ---prefix=/usr/local --with-ssl=/usr/local/ssl --with-nghttp2 

# make && make install

# ldconfig


# /etc/init.d/apachectl -t

Syntax OK

# /etc/init.d/apachectl restart


# curl --version (curl -V)

curl 7.46.0 (x86_64-pc-linux-gnu) libcurl/7.46.0 OpenSSL/1.0.2o zlib/1.2.3 libidn/1.18 nghttp2/1.31.0

Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 

Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets 


반응형

'서버 & 시스템 > Linux' 카테고리의 다른 글

iptables를 통한 fail2ban 설치  (0) 2018.07.20
CentOS 5 저장소 변경  (0) 2018.07.17
각종 서비스 포트번호 확인  (0) 2018.03.27
nginx 설치  (0) 2018.02.20
MySQL 업그레이드 (5.1 → 5.6)  (0) 2018.01.15