如果架设https网站?


HTTPS更安全,哪如何架设成这个安全的协议呢?

网络 php https web服务器 http

yek10r 9 years, 9 months ago

上淘宝搜HTTPS证书或者SSL证书,然后一堆商家愿意手把手教你

奈叶开后宫 answered 9 years, 9 months ago

key(服务器私钥) => csr(Certificate Signing Request,证书签发请求) => crt(证书)
上面几个东西都可以用openssl生成.

  1. 生成服务器.key文件

  2. 根据.key文件生成.csr文件

  3. 提交.csr给证书授权中心CA(Certificate Authority)

  4. CA根据.csr制作.crt证书文件(CA认证后签发的服务器证书)和.ca文件(机构的公钥证书).
    也可以自己用openssl生成crt证书,不过浏览器会警告用户证书没有被认证,但不影响通信加密.

Nginx提供有ngx_http_ssl_module模块,你用ssl_certificate_key指令指定key文件就好:
http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate_key


 server {
    listen              443 ssl;
    keepalive_timeout   70;

    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
    ssl_certificate     /usr/local/nginx/conf/cert.pem;
    ssl_certificate_key /usr/local/nginx/conf/cert.key;
    ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 10m;
}

AokoRin answered 9 years, 9 months ago

carrie answered 9 years, 9 months ago

Your Answer