13

Rails アプリがあり、Google SPDY プロトコルのサポートを設定したいと考えています。しかし、SPDYパッチを使用してNginxをインストールし、仮想ホストでspdyを有効にすると、nginxを再起動できなくなり、代わりに次のエラーがスローされます。

Restarting nginx: nginx: [emerg] invalid parameter "spdy" in /etc/nginx/sites-enabled/default:112
nginx: configuration file /etc/nginx/nginx.conf test failed

最新のnginx 1.3.13をspdyパッチでコンパイルしました。ここでは、インストールの手順について言及しています

wget http://nginx.org/download/nginx-1.3.13.tar.gz
tar xvfz nginx-1.3.13.tar.gz
cd nginx-1.3.13

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

 ./configure \
 --sbin-path=/usr/local/sbin/nginx \
 --prefix=/etc/nginx \
 --conf-path=/etc/nginx/nginx.conf \
 --error-log-path=/var/log/nginx/error.log \
 --http-client-body-temp-path=/var/lib/nginx/body \
 --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
 --http-log-path=/var/log/nginx/access.log \
 --http-proxy-temp-path=/var/lib/nginx/proxy \
 --http-scgi-temp-path=/var/lib/nginx/scgi \
 --http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
 --lock-path=/var/lock/nginx.lock \
 --pid-path=/var/run/nginx.pid \
 --with-debug \
 --with-http_addition_module \
 --with-http_dav_module \
 --with-http_gzip_static_module \
 --with-http_realip_module \
 --with-http_stub_status_module \
 --with-http_ssl_module \
 --with-http_sub_module \
 --with-http_xslt_module \
 --with-http_spdy_module \
 --with-ipv6 \
 --with-sha1=/usr/include/openssl \
 --with-md5=/usr/include/openssl \
 --with-mail \
 --with-mail_ssl_module \

 # wget https://you.googlecode.com/files/ngx_cache_purge-1.6.tar.gz
 --add-module=/software/ngx_cache_purge-1.6 \

 #http://www.openssl.org/source/openssl-1.0.1e.tar.gz
 --with-openssl='/software/openssl-1.0.1e' 

 # Build and install nginx
 make && sudo make install

エラーなしで正常にコンパイルされます。結果 0f nginx -V は次のようになります

nginx version: nginx/1.3.13
built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 
TLS SNI support enabled
configure arguments: --sbin-path=/usr/local/sbin/nginx --prefix=/etc/nginx --conf-           path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_gzip_static_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-http_spdy_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/software/ngx_cache_purge-1.6 --with-openssl=/software/openssl-1.0.1e

私の /etc/nginx/site-enabled 構成には

server {
      listen 443 ssl spdy;

      ssl_certificate      server.crt;
      ssl_certificate_key  server.key;  

      ...
  }

結局、この正常なインストール nginx は、サイト対応ファイルのサーバー ブロックの spdy パラメータで再起動しません。

助言がありますか?ここで何かが欠けていると確信していますが、わかりません。

4

1 に答える 1

13

更新 (2013 年 11 月 19 日): nginx 1.4.3 用に修正されたスクリプト (spdy パッチは必要ありません)

https://gist.github.com/deepak-kumar/7541199#file-compile_nginx_1-4-3_with-spdy-sh

セットアップ用のシェルスクリプトを書きました

https://gist.github.com/deepak-kumar/5069550#file-compile_nginx_with_spdy-sh

問題の解決策を見つけました。

この1.3.13をコンパイルする前でも、ubuntu 12.04にnginxパッケージがインストールされていたため、問題が発生していました。$ sudo apt-get install nginx

この問題を解決するために、/etc/init.d/nginx が正しいバイナリを使用するようにしました。

端末で次のことを行いました:

$ which nginx
$ /usr/local/sbin/nginx

/etc/init.d/nginx間違ったパスを使用していた既存のスクリプトを確認したので、次のDAEMONように変更しました(動作します)

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/nginx # $which nginx

以前の上記の値は (機能しません)

#PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
#DAEMON=/usr/sbin/nginx

ファイルの残りの部分は同じままです。したがって、基本的には正しいバージョンのバイナリを使用しました。

更新: このブログは、皆さんが興味を持っている場合に備えて、非常に優れたリファレンス ポイントでもあります。 http://blog.bubbleideas.com/2012/08/How-to-set-up-SPDY-on-nginx-for-your-rails-app-and-test-it.html

于 2013-03-02T03:03:05.550 に答える