Linux Nginx 1.5.11搭建SSL/HTTPS/SPDY服务器
用以下脚本:
$sudo yum install openssl openssl-devel
$wget http://nginx.org/download/nginx-1.5.11.tar.gz
$tar -zxvf nginx-1.5.11.tar.gz
$wget http://zlib.net/zlib-1.2.11.tar.gz
$tar -zxvf zlib-1.2.11.tar.gz
$cd nginx-1.5.11
$./configure --with-http_ssl_module --with-zlib=../zlib-1.2.11 --with-http_spdy_module
$make
$sudo make install
然后打开/usr/local/nginx/conf/nginx.conf
搜索HTTPS Server,打开对应的配置。证书通过openssl命令生成
$openssl req -newkey rsa:2048 -nodes -keyout rsa_private.key -x509 -days 365 -out cert.crt
server {
listen 443 ssl spdy;
server_name 192.168.0.83;
#charset koi8-r;
#access_log logs/host.access.log main;
ssl_certificate /usr/local/nginx/conf/cert/cert.crt;
ssl_certificate_key /usr/local/nginx/conf/cert/rsa_private.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers RSA;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
启动:
$sudo /usr/local/nginx/sbin/nginx