nginx 配置https

http {

    server {

        listen 443;

        server_name www.qiyuanwang.cn;

        ssl on;

        root html;

        index index.html index.htm;

        ssl_certificate      cert/server.pem;

        ssl_certificate_key  cert/server.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;

        location / {

            root html;

            index index.html index.htm;

            proxy_set_header X-Real-IP $remote_addr;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_set_header Host $host;

    proxy_set_header Upgrade-Insecure-Requests 1;

    proxy_set_header X-Forwarded-Proto https;

    include /etc/nginx/mime.types;

default_type application/octet-stream;   

        }

        error_page  404              /404.html;

    }

    server {

        listen      80;

        server_name  www.qiyuanwang.cn;

        rewrite ^(.*)$ https://${server_name}$1 permanent; 

    }

}

events {

  worker_connections  1024;

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