記錄 Nginx1.4.1 啟用 SPDY 與 OpenSSL1.0.1e


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 更新 Ports Tree
portsnap fetch extract

# 更新自己系統內的 OpenSSL (應該不是必須.只是以防萬一)
cd /usr/ports/security/openssl
make reinstall

cp /usr/local/openssl/openssl.cnf.sample /usr/local/openssl/openssl.cnf
/usr/local/bin/openssl version

# 下載 OpenSSL >= 1.0.1 源碼
cd ~/server
wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz
tar zxvf openssl-1.0.1e.tar.gz

# 重新編譯 Nginx 並打開 SPDY 模組和設定 OpenSSL 源碼的位置
wget http://nginx.org/download/nginx-1.4.2.tar.gz
tar zxvf nginx-1.4.2.tar.gz
cd nginx-1.4.2
./configure --prefix=/usr/local/nginx --user=www --group=www --with-select_module --with-poll_module --with-file-aio --with-http_ssl_module --with-http_realip_module --with-http_geoip_module --with-http_gzip_static_module --with-http_secure_link_module --with-http_sub_module --with-http_stub_status_module --with-http_perl_module --with-openssl=../openssl-1.0.1e --with-http_spdy_module
make
make install

# 修改網站設定檔,打開 SPDY 支持
vim /usr/local/nginx/conf/vhost/example.com.conf

change

server {
listen 443;
}

to

server {
listen 443 ssl spdy;
}

# 重啟 Nginx
killall nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf


# 測試
Chrome 插件 (SPDY indicator)

安裝後,如遇到支持 SPDY 的網站會在網址欄顯示綠色圖示

網頁檢查

http://spdycheck.org/