CentOS6.4+Nginx1.5.10+SPDY

ベースとなるNginxをインストール

#リポジトリを取り込み
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

#ベースとなるnginxをインストール
yum install nginx

#一回実行しといて、必要なものを作らせとこう。
service nginx start
service nginx stop

ソースコードを取得してきて、makeしてインストール

CentOS向けNginxのConfig+--with-http_spdy_moduleでmakeする。

#ソースを取得して展開
wget http://nginx.org/download/nginx-1.5.10.tar.gz
tar xzf nginx-1.5.10.tar.gz

cd nginx-1.5.10


#必要な奴を適当にインストール
yum install pcre-devel

#Defaultの設定 + SPDYでインストール
./configure  --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-http_spdy_module

Nginxには既にSPDY用のソースが含まれている。
Ver1.5.10以前までは、draft2のソース、それ以降はdraft3が含まれているので特にPatchを当てる必要はない。

http://nginx.org/en/docs/http/ngx_http_spdy_module.html

make 
make install

インストールできたら[nginx -V]でSPDYが有効になっているか(--with-http_spdy_moduleがあるか)を調べる。

SPDYインジケータをchromeにインストールしておく。

後で調べるために使う。

https://chrome.google.com/webstore/detail/spdy-indicator/mpbpobfflnpcgagjijhmgnchggcjblin

オレオレSSL証明書詐欺

http://mizushima.ne.jp/Linux/SSL/csr-key.php

req -new -days 365 -x509 -nodes -keyout cert.key -out cert.crt

/etc/nginxに作った奴をコピーしとく

SSLでアクセスするための設定

基本的にはexsample_ssl.confをベースにして作る。
ミソは、sslの証明書のPath設定と、listenにspdyを追加すること。

# HTTPS server
#
server {
    listen       443 ssl spdy;
    server_name  localhost;

    ssl_certificate      /etc/nginx/cert.crt;
    ssl_certificate_key  /etc/nginx/cert.key;

    ssl_session_cache shared:SSL:1m;
    ssl_session_timeout  5m;

    ssl_ciphers  HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
}

nginxをリスタートしたら、接続テスト。

service nginx restart