Nginx配置https网站

因为Nginx默认从conf目录搜索https证书,所以https证书一般存放到conf目录下。

#省略一些配置
......

http {
    include        mime.types;
    default_type   application/octet-stream;
    sendfile       on;
    keepalive_timeout  65;
    charset   utf-8;

    server {
        listen  443;
        server_name   www.3n6mu.org;
        ssl   on;
        ssl_certificate        cert/3n6mu.org.crt; # https证书
        ssl_certificate_key    cert/3n6mu.org.key; # RSA私钥
        ssl_session_timeout   5m;
        ssl_protocols   TLSv1.2;
        ssl_ciphers    HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers   on;
        location / {
            root   html;
            index  index.html index.php;
        }
    }
}

#省略一些配置
......

猜你喜欢

转载自www.cnblogs.com/dgjnszf/p/11960888.html