Nginx配置ssl

/Nginx/conf/ssl下

demo.crt

demo.key

#vi nginx.conf 
events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;

    server {
        listen       80;
        server_name  localhost;
        location / {
            proxy_pass http://127.0.0.1:8080/;
        }
    }
    server {
        listen 443 ssl;
        server_name localhost;
        ssl_certificate ssl/demo.crt;
        ssl_certificate_key ssl/demo.key;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE;
        ssl_prefer_server_ciphers on;
        location / {
            proxy_set_header Host $host;
            proxy_set_header X-Real-Ip $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header X-protocol https;
            proxy_pass http://127.0.0.1:8080/;
        }
    }
}

 

 

你可能感兴趣的:(证书,Nginx)