반응형

오늘은 Ubuntu 18.04 기준에서 http2.0 을 적용하는 방법에 대해서 알아보자.

http2 가 http 보다 좋은건 딱히 설명할 여지가 없다. 

속도가 우선 어마어마하게 개선되었음. 하지만 한국에서는 인터넷 속도가 빨라서 그런지 http2 가 좋은 이유를 모르는 것 같다.

우리가 서버셋팅을 할때 간단하게 몇줄만 넣어주면 되니 아래를 잘 따라하도록 하자.

(1) Apache Version 확인하기

- 공식문서에 보면 Apache Version 2.4.24 이상에서만 http2.0 을 지원한다.
- 그렇다면 자신의 서버에 설치된 Apache의 버젼이 몇인지 확인해보자.

# /etc/apache2# apache2 -v
Server version: Apache/2.4.29 (Ubuntu)
Server built:   2022-06-23T12:51:37

또는

#:/etc/apache2# dpkg -l | grep apache2
ii  apache2                                2.4.29-1ubuntu4.25                              amd64        Apache HTTP Server
ii  apache2-bin                            2.4.29-1ubuntu4.25                              amd64        Apache HTTP Server (modules and other binary files)
ii  apache2-data                           2.4.29-1ubuntu4.25                              all          Apache HTTP Server (common files)
ii  apache2-utils                          2.4.29-1ubuntu4.25                              amd64        Apache HTTP Server (utility programs for web servers)
ii  libapache2-mod-jk                      1:1.2.43-1                                      amd64        Apache 2 connector for the Tomcat Java servlet engine

이렇게 확인할 수 있다. 대충 봐도 2.4.29 이니 크게 상관없을듯 하다. 만약 2.4.25 미만인 경우에는 upgrade ppa 추가해서 하면 된다.

(2) http2 모드 활성화 초간단 설정 

- 딱 2개만 넣으면 된다.
- 일단 http2 mod 활성화

# sudo a2enmod http2
Module http2 already enabled

난 이미 모드를 활성화 해놔서 저렇게 뜸.. 모드 활성화 명령어를 입력해주세요.

(3) 특정 프로젝트 설정파일에 집어넣기!

# sudo vim /etc/apache2/sites-available/000-default.conf
~~~~~ (내용)


<VirtualHost *:443>

        ServerName 사이트도메인

        SSLEngine on
        SSLCertificateKeyFile /~~~/.key.pem
        SSLCertificateFile /~~~/.pem
        SSLCACertificateFile /~~~/.pem

        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ErrorLog ${APACHE_LOG_DIR}/error.log

        # HTTP2 Protocol
        Protocols h2 http/1.1
</VirtualHost>

여기서 Protocols h2 http/1.1 만 보면된다.

개쉬움 자 그럼 사이트 들어가서 f12 눌러서 프로토콜을 보자.

(4) http2.0 적용 확인방법

위 그림 처럼 protocol에 h2 라고 나오면 끝!!!

 

개쉬움 어서어서 적용하시오.!!!!1

반응형

+ Recent posts