Media Log




우분투 Nginx 업그레이드


순서 1

추가 /etc/apt/sources.list

deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx

deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx


순서 2

$ sudo mkdir /opt/nginx

$ cd /opt/nginx

$ sudo apt-get update

$ sudo apt-get build-dep nginx

$ sudo apt-get source nginx

$ ls -1p

nginx-1.9.5/

nginx_1.9.5-1~trusty.debian.tar.gz

nginx_1.9.5-1~trusty.dsc

nginx_1.9.5.orig.tar.gz


순서 3

ngx_pagespeed

$ sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip


$ sudo mkdir -p /opt/ngx_pagespeed

$ sudo wget https://github.com/pagespeed/ngx_pagespeed/archive/release-1.9.32.6-beta.zip

$ sudo unzip release-1.9.32.6-beta.zip

$ cd ngx_pagespeed-release-1.9.32.6-beta

$ sudo wget https://dl.google.com/dl/page-speed/psol/1.9.32.6.tar.gz

$ sudo tar -xzvf 1.9.32.6.tar.gz


순서4

추가 /opt/nginx/nginx-1.9.5/debian/rules

override_dh_auto_build:

        ...

        --with-ipv6 \

추가

--add-module=/opt/ngx_pagespeed/ngx_pagespeed-release-1.9.32.6-beta


configure_debug:

        ...

        --with-debug \

        추가

        --add-module=/opt/ngx_pagespeed/ngx_pagespeed-release-1.9.32.6-beta


순서5

$ cd /opt/nginx/nginx-1.9.5

$ sudo dpkg-buildpackage -b



순서6

위에서 실행후 nginx_1.9.5-1~trusty_amd64.deb 생성됨


$ cd /opt/nginx

$ ls -1p

nginx-1.9.5/

nginx-dbg_1.9.5-1~trusty_amd64.deb

nginx-debug_1.9.5-1~trusty_amd64.deb

nginx_1.9.5-1~trusty.debian.tar.gz

nginx_1.9.5-1~trusty.dsc

nginx_1.9.5-1~trusty_amd64.changes

nginx_1.9.5-1~trusty_amd64.deb

nginx_1.9.5.orig.tar.gz


순서7

설치  생성된 nginx_1.9.5-1~trusty_amd64.deb 설치함


$ cd /opt/nginx

$ sudo service nginx stop

$ sudo dpkg -i nginx_1.9.5-1~trusty_amd64.deb

$ sudo service nginx start


순서8

수정  HTTP/2 추가

/etc/nginx/conf.d/default_ssl.conf


server {

    ...

    listen       443 ssl http2;

    listen       [::]:443 ssl http2;

    ...

}


순서9

시작

$ sudo service nginx restart



에러 뿜으면 다시 이렇게

sudo apt-get remove nginx


키입력

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C


sudo apt-add-repository ppa:nginx/development

sudo apt-get update

sudo apt-get install nginx


$ wget http://nginx.org/packages/keys/nginx_signing.key


$ cat nginx_signing.key | sudo apt-key add -

OK


$ apt-get update


$apt-get install nginx



submit