需要在编译的时候安装SSL模块
./configure --with-http_ssl_module
make && make install
需要安装openssl
yum install openssl
根据报错信息安装以下需要的软件
yum -y install pcre-devel
生成服务器的KEY和证书签名
sudo openssl genrsa -des3 -out server.key 1024
sudo openssl req -new -key server.key -out server.csr
sudo cp server.key server.key.org sudo openssl rsa -in server.key.org -out server.key
365天后会失效
sudo openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
nginx.conf配置
server { listen 443; server_name localhost; ssl on; ssl_certificate /etc/ssl/server.crt; ssl_certificate_key /etc/ssl/server.key; ssl_session_timeout 5m; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { proxy_set_header Host $http_host; proxy_pass http://unicorn_staging; } }