开始Nginx的SSL模块

nginx配置SSL模块
下载nginx源码包

wget http://nginx.org/download/nginx-1.5.9.tar.gz

解压 :

tar -zxvf nginx-1.5.9.tar.gz

进入nginx文件夹

cd nginx-1.5.9

进行编译把一些插件编译安装 。这个一定要加 --with-http_ssl_module

./configure --prefix=/home/soft/nginx  \
--conf-path=/home/soft/nginx/etc/nginx.conf  \
--user=nginx --group=nginx  \
--error-log-path=/home/soft/nginx/nginxlog/error.log  \
--http-log-path=/home/soft/nginx/nginxlog/access.log  \
--pid-path=/home/soft/nginx/pids/nginx.pid  \
--lock-path=/home/soft/nginx/locks/nginx.lock  \
--with-http_ssl_module  \
--with-http_stub_status_module  \
--with-http_gzip_static_module  \
--http-client-body-temp-path=/home/soft/nginx/tmp/client  \
--http-proxy-temp-path=/home/soft/nginx/tmp/proxy  \
--http-fastcgi-temp-path=/home/soft/nginx/tmp/fastcgi  \
--http-uwsgi-temp-path=/home/soft/nginx/tmp/uwsgi  \
--http-scgi-temp-path=/home/soft/nginx/tmp/scgi
执行 make & make install
 server {
        listen       80;
		listen 443  ssl;
        server_name  你的域名;

        location / {
           proxy_redirect off;
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           #这个可以是项目jar包的端口,根据自身的情况修改
           proxy_pass http://127.0.0.1:20890;
        }
        #这个文件在nginx/conf 下面 安装自定义配置
		ssl_certificate  cert/3161394_wechata.ydc.haoxincm.com.pem;
		#这个文件在nginx/conf 下面 安装自定义配置
        ssl_certificate_key cert/3161394_wechata.ydc.haoxincm.com.key;
        
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
        ssl_prefer_server_ciphers on;
      }

重启nginx,即可
密匙证书在够买的服务器上申请,有免费版的使用

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值