码迷,mamicode.com
首页 > 其他好文 > 详细

Nginx配置SSL加密访问

时间:2017-05-24 12:44:31      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:filename   span   sts   adf   default   ssl   sla   nginx配置   ken   

1.申请证书,可到 https://www.sslforfree.com/ 申请免费证书,有效期3个月。

2.下载证书文件到服务器.

3.配置Nginx的vhosts.conf文件,以www.abc.net为例。

server {
        listen       443 ssl;
        server_name  www.abc.net alias ;

        ssl_certificate      E:/UPUPW/cert/certificate.crt;
        ssl_certificate_key  E:/UPUPW/cert/private.key;
    
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
    
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        location / {
            root   E:/www/www.abc.net;
            index  index.html index.htm default.html default.htm index.php default.php app.php u.php;
            include        E:/www/www.abc.net/up-*.conf;
            if (!-e $request_filename) {
               rewrite  ^(.*)$  /index.php?s=/$1  last;
               break;
            }
        }
        autoindex off;
        include advanced_settings.conf;
        #include expires.conf;
        location ~* .*\/(attachment|attachments|uploadfiles|avatar)\/.*\.(php|php5|phps|asp|aspx|jsp)$ {
        deny all;
        }
        location ~ ^.+\.php {
            root           E:/www/www.abc.net;
            fastcgi_pass   bakend;
            fastcgi_index  index.php;
            fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
            fastcgi_param  PATH_INFO $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED $document_root$fastcgi_path_info;
            include        fastcgi.conf;
        
            }
    }

 

Nginx配置SSL加密访问

标签:filename   span   sts   adf   default   ssl   sla   nginx配置   ken   

原文地址:http://www.cnblogs.com/ucdn/p/6897851.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!