2016年11月18日 星期五

電腦 nginx增加ssl功能

增加ssl
nginx.conf
server {
    listen              443 ssl;
    server_name           www.example.com;
    ssl_certificate          www.example.com.crt;
    ssl_certificate_key  www.example.com.key;
    ssl_protocols          TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers             HIGH:!aNULL:!MD5;
    ...
}
測試ssl
openssl s_client -connect www.example.com:443
==
HTTPS server optimization

worker_processes auto;
nginx.conf
http {
    ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 10m;

    server {
        listen              443 ssl;
        server_name         www.example.com;
        keepalive_timeout   70;

        ssl_certificate         www.example.com.crt;
        ssl_certificate_key  www.example.com.key;
        ssl_protocols         TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers             HIGH:!aNULL:!MD5;
        ...

==
Name-based HTTPS servers
server {
    listen          443 ssl;
    server_name     www.example.com;
    ssl_certificate www.example.com.crt;
    ...
}

server {
    listen          443 ssl;
    server_name     www.example.org;
    ssl_certificate www.example.org.crt;
    ...
}

or
server {
    listen          192.168.1.1:443 ssl;
    server_name     www.example.com;
    ssl_certificate www.example.com.crt;
    ...
}

server {
    listen          192.168.1.2:443 ssl;
    server_name     www.example.org;
    ssl_certificate www.example.org.crt;
    ...
}
==
An SSL certificate with several names

ssl_certificate     common.crt;
ssl_certificate_key common.key;

server {
    listen          443 ssl;
    server_name     www.example.com;
    ...
}

server {
    listen          443 ssl;
    server_name     www.example.org;
    ...
}

Configuring HTTPS servers

沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。