给网站添加免费Https SSL证书
2017-05-07 18:26
851 查看
基于阿里云的云盾证书服务,系统是centos6.8,web服务器是nginx1.8.0,简单记录下踩坑情况。
![](https://images2015.cnblogs.com/blog/743630/201705/743630-20170507175250414-1213036988.jpg)
申请证书
登录阿里云控制台→安全(云盾)→证书服务→购买证书(https://common-buy.aliyun.com/?spm=5176.2020520163.cas.1.zTLyhO&commodityCode=cas#/buy)![](https://images2015.cnblogs.com/blog/743630/201705/743630-20170507175632664-2076800421.jpg)
完成购买后补全信息:填写域名信息、填写个人信息。注意验证域名这步,没有勾选证书绑定。。。那句的话需要在域名解析中增加一条txt类型的解析。
上传,选择系统生成CSR,点击创建然后再提交审核。
审核成功后就可以下载证书然后上传到网站了,下面说下配置
配置SSL
可以将证书放置在任意位置,这里放置在nginx配置目录下的ssl目录里(需要新建ssl目录)编辑配置文件
vim blog_ssl.conf
server { listen 80; server_name domainname; return 301 https://$server_name$request_uri; } server { listen 443; server_name domainname; ssl on; index index.html index.htm index.php; root /path/to/webroot; ssl_certificate_key sslpath/214091409160173.key; ssl_certificate /sslpath/214091409160173.pem; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; location / { # if (!-e $request_filename){ # rewrite ^/(.*) /index.php last; # } root /path/to/webroot/subdir/web; try_files $uri subdir/web/index.php?$args; # avoiding processing of calls to non-existing static files by Yii location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { access_log off; expires 360d; try_files $uri =404; } } location /admin { alias /path/to/webroot/backend/web; rewrite ^(/admin)/$ $1 permanent; try_files $uri /backend/web/index.php?$args; } # avoiding processing of calls to non-existing static files by Yii location ~ ^/admin/(.+\.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar))$ { access_log off; expires 360d; rewrite ^/admin/(.+)$ /backend/web/$1 break; rewrite ^/admin/(.+)/(.+)$ /backend/web/$1/$2 break; try_files $uri =404; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location = /requirements.php { deny all; } location ~ \.(ht|svn|git) { deny all; } }
保存,然后sbin/nginx -t检测一下
提示nginx: [emerg] unknown directive "ssl" 说明没有将ssl模块编译进nginx,到nginx的源码路径下重新编译下nginx 加上--with-http_ssl_module 然后make后不用make install 否则就会覆盖安装了。然后将新的可执行程序拷贝覆盖下之前的可执行程序
#cp -rfp objs/nginx /app/local/nginx/sbin/nginx
然后重启nginx
验证配置
![](https://images2015.cnblogs.com/blog/743630/201705/743630-20170507182528914-557067391.jpg)
相关文章推荐
- 八大免费SSL证书-给你的网站免费添加Https安全加密
- 八大免费SSL证书-给你的网站免费添加Https安全加密
- 十大免费SSL证书:网站免费添加HTTPS加密
- 八大免费SSL证书-给你的网站免费添加Https安全加密
- 十大免费SSL证书:网站免费添加HTTPS加密
- 使用免费SSL证书让网站支持HTTPS访问
- 如何给网站添加SSL证书(免费)
- StartSSL免费SSL证书成功申请-HTTPS让访问网站更安全
- Let's Encrypt 使用教程,免费的SSL证书,让你的网站拥抱 HTTPS
- 如何给网站添加SSL证书(免费)
- IIS - 自动申请、部署Let's Encrypt的免费SSL证书(让网站实现HTTPS协议)
- 网站http改https Let’s Encrypt 安装 续期教程 免费ssl证书Let’s Encrypt使用教程Certbot
- CentOS+Apache使用免费SSL证书实现https网站
- [从零开始搭网站六]为域名申请免费SSL证书(https),并为Tomcat配置https域名所用的多SSL证书
- 如何给网站添加SSL证书(免费)?
- 阿里云免费SSL证书有吗?阿里云网站HTTPS免费证书申请地址
- 使用免费软件portecle从https网站上导出SSL证书与中级证书CA指南
- 网站升级HTTPS,免费SSL证书Let’s Encrypt安装使用教程:Apache和Nginx配置方法
- StartSSL免费SSL证书成功申请-HTTPS让访问网站更安全
- 免费SSL证书给网站搭建HTTPS