Nginx Config SSL Certificate 2
时间:2016-12-22 16:01 来源:linux.it.net.cn 作者:IT
-
域名验证 (DV) 证书可核实您对域名拥有所有权
-
而组织验证 (OV) 证书证明您拥有该域名并且您的组织是合法的。这让访客更加放心,因为欺诈性网站绝对无法通过这些检查。
-
扩展验证 (EV) SSL 为客户提供最高级别的安全保障 - EV SSL 申请人必须通过严谨的扩展验证流程。
当用户输入 EV SSL 加密的网站时,其浏览器中的地址栏会变绿。它是一种具有强烈视觉效果的“绿光”,可以告诉用户他们所在的网站很安全。
几家免费的证书申请
-
godaddy https://sg.godaddy.com/zh/web-security/ssl-certificate
-
startssl https://www.startssl.com/
-
letsencrypt https://letsencrypt.org/
-
qcloud https://www.qcloud.com/product/ssl
-
qiniu https://support.qiniu.com/hc/kb/article/223541
-
StartSSL 听说因违规被 Google, Apple 注消了根证书。
-
letsencrypt 只有三个月,看了教程,要装一个程序来申请和更新,和想像中的不一样,没细看。
-
Qiniu 我申请了,真的就等了24小时,一切都成功了,就是没收到邮件发来的证书。
-
Qcloud 腾讯云很快,差不多 20 分钟就一切都好了。
最后因为 Qcloud 拿到了证书,就选了它家。
操作
现在找到的教程都好老,还是要申请 key 和 CSR,在七牛里找了好久也没找到填这个的地方,后来 qcloud 里下载到证书后,才明白。
根本不需要
系统自动创建了 key,然后生成 crt 证书文件,最后把这两个文件按照各种不同的 web server 的要求,创建好打包下载,直接使用,太方便了。
绑定
拿到证书文件后,就需要在 nginx 里进行域名的绑定了。
一般来说 nginx 都是做端口转发的,
# NGINX site configuration
upstream app_server {
server 10.1.1.1:8081 max_fails=3 fail_timeout=0;
}
server {
listen 443;
server_name d2labs.cn;
ssl on;
ssl_certificate_key /etc/nginx/ssl/d2labs.cn.key;
ssl_certificate /etc/nginx/ssl/d2labs.cn.crt;
keepalive_timeout 10;
access_log /var/log/nginx/d2labs.access.log main;
error_log /var/log/nginx/d2labs.error.log;
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
# disable any limits to avoid HTTP 413 for large image uploads
client_max_body_size 75M;
# required to avoid HTTP 411: see Issue #1486 (https://github.com/docker/docker/issues/1486)
chunked_transfer_encoding on;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
proxy_pass http://app_server;
}
}
如果我想禁止 HTTP,只开启 HTTPS 呢?
或者两个都想支持呢?
(责任编辑:IT)
当用户输入 EV SSL 加密的网站时,其浏览器中的地址栏会变绿。它是一种具有强烈视觉效果的“绿光”,可以告诉用户他们所在的网站很安全。 几家免费的证书申请
最后因为 Qcloud 拿到了证书,就选了它家。 操作现在找到的教程都好老,还是要申请 key 和 CSR,在七牛里找了好久也没找到填这个的地方,后来 qcloud 里下载到证书后,才明白。 根本不需要 系统自动创建了 key,然后生成 crt 证书文件,最后把这两个文件按照各种不同的 web server 的要求,创建好打包下载,直接使用,太方便了。 绑定拿到证书文件后,就需要在 nginx 里进行域名的绑定了。 一般来说 nginx 都是做端口转发的, # NGINX site configuration upstream app_server { server 10.1.1.1:8081 max_fails=3 fail_timeout=0; } server { listen 443; server_name d2labs.cn; ssl on; ssl_certificate_key /etc/nginx/ssl/d2labs.cn.key; ssl_certificate /etc/nginx/ssl/d2labs.cn.crt; keepalive_timeout 10; access_log /var/log/nginx/d2labs.access.log main; error_log /var/log/nginx/d2labs.error.log; error_page 404 /404.html; # redirect server error pages to the static page /50x.html error_page 500 502 503 504 /50x.html; # disable any limits to avoid HTTP 413 for large image uploads client_max_body_size 75M; # required to avoid HTTP 411: see Issue #1486 (https://github.com/docker/docker/issues/1486) chunked_transfer_encoding on; location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_redirect off; proxy_pass http://app_server; } } 如果我想禁止 HTTP,只开启 HTTPS 呢? 或者两个都想支持呢? (责任编辑:IT) |