nginx配置https

server {
    root /var/www/html;
    index index.html index.htm index.nginx-debian.html;      

    # https setting
    listen 443;
    server_name #yourdomain#;
    ssl on;
    ssl_certificate          /etc/nginx/cert/xxx_xxx.pem;
    ssl_certificate_key      /etc/nginx/cert/xxx_xxx.key;
    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;
    # end https

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }
}

server {
    listen 80;
    server_name pay.himetoo.com;
    rewrite ^(.*)$ https://$host$1 permanent;
}

你可能感兴趣的:(nginx配置https)