编译安装nghttp2遇到的问题

本文只是记录编译nghttp2所遇到的问题的解决方法,具体步骤请看这里(十分详细)。


环璄:Ubuntu 14.04TLS X64
1、nghttp2依赖spdylay,安装spdylay后,运行spdycat提示:

spdycat: error while loading shared libraries: libspdylay.so.7: cannot open shared object file: No such file or directory

然后ldd `which spdycat`,会发现缺少运行库libspdylay.so.7

ldd `which spdycat`
	linux-vdso.so.1 =>  (0x00007fffced6e000)
	libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007ff963dff000)
	libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007ff963a24000)
	libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007ff9636bd000)
	libspdylay.so.7 => not found
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff9633b9000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff9631a2000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff962f84000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff962bbf000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff9629ba000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff9627a1000)
	liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007ff96257f000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff962278000)
	/lib64/ld-linux-x86-64.so.2 (0x00007ff964066000)

运行find /usr/local -name libspdylay.so

/usr/local/lib/libspdylay.so

创建libspdylay.so的软链接,再次运行spdycat,无错误返回即可

sudo ln -s /usr/local/lib/libspdylay.so /lib/x86_64-linux-gnu/libspdylay.so.7

2、nghttp2同样会遇到缺运行库的错误,同样地ln -s

sudo ln -s /usr/local/lib/libnghttp2.so /lib/x86_64-linux-gnu/libnghttp2.so.5
nghttpx
Usage: nghttpx [OPTIONS]... [<PRIVATE_KEY> <CERT>]
A reverse proxy for HTTP/2, HTTP/1 and SPDY.
01/Apr/2015:00:20:13 +0800 PID14428 [FATAL] shrpx.cc:1999 Too few arguments

至此,编译、安装部分完成。

3、Chrome连接nghttp2 proxy时报spdy错误
“Error code:ERR_SPDY_PROTOCOL_ERROR”,这是Chrome的BUG,只需要把nghttpx协商的优先顺序改为spdy/3.1即可

sudo nghttpx -s -f0.0.0.0,443 -b127.0.0.1,8080 \
/etc/nghttpx/certs/ssl.key /etc/nghttpx/certs/ssl.crt \
--npn-list=spdy/3.1,h2

4 thoughts on “编译安装nghttp2遇到的问题

  1. 3、Chrome连接nghttp2 proxy时报spdy错误
    “Error code:ERR_SPDY_PROTOCOL_ERROR”,这是Chrome的BUG,只需要把nghttpx运行在spdy/3.1下即可

    核对一下你OpenSSL什么版本,Git上有提到,最低要求是OpenSSL >= 1.0.1

    但是必须OpenSSL >= 1.0.2才支持ALPN

    ALPN是HTTP/2必须的

    1. 上海邦达天原国际货运有限公司(邦联集团)的台湾人邢台明(台湾身份证号:A104503012)与台湾人邢冠楷(台湾身份证:A126905181,二人系父子关系)在大陆使用行贿的方式非法办理多个假户口、假身份证,并使用非法办理的假户口、假身份证从事违法犯罪活动,在此督促台湾人邢台明、台湾人邢冠楷尽快投案自首。

Leave a Reply

Your email address will not be published. Required fields are marked *