h1763656169

1、安装SSL模块

./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/usr/local/nginx/log/error.log \
--http-log-path=/usr/local/nginx/log/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi  \
--with-http_ssl_module #SSL模块

 

2、编译安装

make
make install

 

3、配置https证书

  把ssl证书 *.crt 和私钥 *.key 拷贝到目录中。

  

server {
        listen       443 ssl;
        server_name  test.com;

        ssl_certificate  #配置ssl证书    
/usr/local/webSSL/test_com/5528763_www.test.com.pem; ssl_certificate_key #配置证书私钥
/usr/local/webSSL/test_com/5528763_www.test.com.key; # ssl会话cache ssl_session_cache shared:SSL:1m; # ssl会话超时时间 ssl_session_timeout 5m; # 配置加密套件,写法遵循 openssl 标准 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; location / { proxy_pass http://tomcats/; index index.html index.htm; } }

 

./sbin/nginx -t #检查配置
./sbin/nginx -s reload #重启

 

分类:

技术点:

相关文章: