LoginSignup
3
4

More than 5 years have passed since last update.

nginx+passenger+spdyをインストールする

Posted at

Ubuntu 12.04でnginx+passenger+spdyをインストール

既存のnginxが入っている場合は、先にaptitude purgeなどで削除しましょう。

passenger-nginx-spdy.sh
#!/bin/sh

NGINX_VERSION=1.3.11
TMP_PATH=/tmp

# Fetch and extract Nginx
cd $TMP_PATH
wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz
tar xvfz nginx-$NGINX_VERSION.tar.gz
cd nginx-$NGINX_VERSION

# Fetch and apply the Nginx SPDY patch
wget http://nginx.org/patches/spdy/patch.spdy.txt
patch -p1 < patch.spdy.txt

# Install the latest passenger gem
# 必要に応じてrvmsudoをつけましょう
gem install passenger

# Configure passenger (with ubuntu-style paths)
# ここもrvmsudoを必要に応じてつけて下さい
passenger-install-nginx-module \
  --auto \
  --nginx-source-dir=$TMP_PATH/nginx-$NGINX_VERSION \
  --prefix=/usr \
  --extra-configure-flags=" \
    --conf-path=/etc/nginx/nginx.conf \
    --pid-path=/var/run/nginx.pid \
    --sbin-path=/usr/sbin \
    --error-log-path=/var/log/nginx/error.log \
    --http-log-path=/var/log/nginx/access.log \
    --with-http_spdy_module"

# Cleanup
sudo rm -r $TMP_PATH/nginx-$NGINX_VERSION
rm $TMP_PATH/nginx-$NGINX_VERSION.tar.gz

これでnginxをインストールし、
http://nginx.org/patches/spdy/README.txt
にあるようにnginx.confで

/etc/nginx/nginx.conf
  server {
      listen 443 ssl spdy default_server;
      ssl_certificate      server.crt;
      ssl_certificate_key  server.key;
  }

のような記述を書き足せば利用できます。
SPDYはSSL必須なので、適当にSSL証明書を作り/etc/nginx/sslとかにでも入れておきましょう。

ちゃんとSPDYで通信できているか確認するには、chromeで
SPDY Indicator
をインストールし、httpsでアクセスし、緑色のアイコンになることをチェックしましょう。

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4