# HG changeset patch # User Ruslan Ermilov # Date 1346147996 0 # Node ID ba45bd0fc71eb8ddb9c8a4e263d6cc9edbfab5bd # Parent 77a3314c74a784ae4576126054ca8583867c9bb2 configuring_https_servers: markup changes (mostly). diff --git a/xml/en/docs/http/configuring_https_servers.xml b/xml/en/docs/http/configuring_https_servers.xml --- a/xml/en/docs/http/configuring_https_servers.xml +++ b/xml/en/docs/http/configuring_https_servers.xml @@ -21,13 +21,13 @@ and private key files should be specifie server { - listen 443; - server_name www.example.com; - ssl on; - ssl_certificate www.example.com.crt; - ssl_certificate_key www.example.com.key; - ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; - ssl_ciphers HIGH:!aNULL:!MD5; + listen 443; + server_name www.example.com; + ssl on; + ssl_certificate www.example.com.crt; + ssl_certificate_key www.example.com.key; + ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers HIGH:!aNULL:!MD5; ... } @@ -35,12 +35,12 @@ server { The server certificate is a public entity. It is sent to every client that connects to the server. The private key is a secure entity and should be stored in a file with -restricted access, however, it must be readable by nginx’s master process. +restricted access, however, it must be readable by nginx’s master process. The private key may alternately be stored in the same file as the certificate: - ssl_certificate www.example.com.cert; - ssl_certificate_key www.example.com.cert; + ssl_certificate www.example.com.cert; + ssl_certificate_key www.example.com.cert; in which case the file access rights should also be restricted. @@ -53,7 +53,8 @@ The directives can be used to limit connections to include only the strong versions and ciphers of SSL/TLS. -Since version 1.0.5, nginx uses “ssl_protocols SSLv3 TLSv1” +Since version 1.0.5, nginx uses +“ssl_protocols SSLv3 TLSv1” and “ssl_ciphers HIGH:!aNULL:!MD5” by default, so configuring them explicitly only makes sense for the earlier nginx versions. Since versions 1.1.13 and 1.0.12, nginx uses @@ -96,25 +97,25 @@ It can be increased by using the directive. Here is a sample configuration optimized for a quad core system -with 10M shared session cache: +with 10 megabyte shared session cache: -worker_processes 4; +worker_processes 4; http { - ssl_session_cache shared:SSL:10m; - ssl_session_timeout 10m; + ssl_session_cache shared:SSL:10m; + ssl_session_timeout 10m; server { - listen 443; - server_name www.example.com; - keepalive_timeout 70; + listen 443; + server_name www.example.com; + keepalive_timeout 70; - ssl on; - ssl_certificate www.example.com.crt; - ssl_certificate_key www.example.com.key; - ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; - ssl_ciphers HIGH:!aNULL:!MD5; + ssl on; + ssl_certificate www.example.com.crt; + ssl_certificate_key www.example.com.key; + ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers HIGH:!aNULL:!MD5; ... @@ -142,16 +143,15 @@ in the combined file: The resulting file should be used in the - -directive: + directive: server { - listen 443; - server_name www.example.com; - ssl on; - ssl_certificate www.example.com.chained.crt; - ssl_certificate_key www.example.com.key; + listen 443; + server_name www.example.com; + ssl on; + ssl_certificate www.example.com.chained.crt; + ssl_certificate_key www.example.com.key; ... } @@ -165,7 +165,7 @@ SSL_CTX_use_PrivateKey_file(" ... /www.e X509_check_private_key:key values mismatch) -because nginx has tried to use the private key with the bundle’s +because nginx has tried to use the private key with the bundle’s first certificate instead of the server certificate. @@ -203,12 +203,12 @@ Certificate chain ... -In this example the subject (“s”) of the +In this example the subject (“s”) of the www.GoDaddy.com server certificate #0 is signed by an issuer -(“i”) which itself is the subject of the certificate #1, +(“i”) which itself is the subject of the certificate #1, which is signed by an issuer which itself is the subject of the certificate #2, which signed by the well-known issuer ValiCert, Inc. -whose certificate is stored in the browsers’ built-in +whose certificate is stored in the browsers’ built-in certificate base (that lay in the house that Jack built). @@ -230,11 +230,11 @@ and adding the ssl pa server { - listen 80; - listen 443 ssl; - server_name www.example.com; - ssl_certificate www.example.com.crt; - ssl_certificate_key www.example.com.key; + listen 80; + listen 443 ssl; + server_name www.example.com; + ssl_certificate www.example.com.crt; + ssl_certificate_key www.example.com.key; ... } @@ -243,7 +243,7 @@ server { Prior to 0.8.21, nginx only allows the ssl parameter to be set on listen sockets with the default parameter: -listen 443 default ssl; +listen 443 default ssl; @@ -259,28 +259,28 @@ listening on a single IP address: server { - listen 443; - server_name www.example.com; - ssl on; - ssl_certificate www.example.com.crt; + listen 443; + server_name www.example.com; + ssl on; + ssl_certificate www.example.com.crt; ... } server { - listen 443; - server_name www.example.org; - ssl on; - ssl_certificate www.example.org.crt; + listen 443; + server_name www.example.org; + ssl on; + ssl_certificate www.example.org.crt; ... } -With this configuration a browser receives the certificate of the default -server, i.e., www.example.com regardless of the requested server name. -This is caused by SSL protocol behaviour. The SSL connection is established -before the browser sends an HTTP request and nginx does not know -the name of the requested server. Therefore, it may only offer the certificate -of the default server. +With this configuration a browser receives the default server’s certificate, +i.e. www.example.com regardless of the requested server name. +This is caused by SSL protocol behaviour. +The SSL connection is established before the browser sends an HTTP request +and nginx does not know the name of the requested server. +Therefore, it may only offer the default server’s certificate. @@ -289,18 +289,18 @@ is to assign a separate IP address for e server { - listen 192.168.1.1:443; - server_name www.example.com; - ssl on; - ssl_certificate www.example.com.crt; + listen 192.168.1.1:443; + server_name www.example.com; + ssl on; + ssl_certificate www.example.com.crt; ... } server { - listen 192.168.1.2:443; - server_name www.example.org; - ssl on; - ssl_certificate www.example.org.crt; + listen 192.168.1.2:443; + server_name www.example.org; + ssl on; + ssl_certificate www.example.org.crt; ... } @@ -310,24 +310,26 @@ server {
+ name="An SSL certificate with several names"> There are other ways to share a single IP address between several HTTPS servers, however, all of them have drawbacks. One way is to use a certificate with several names in -the SubjectAltName certificate field, for example, www.example.com -and www.example.org. +the SubjectAltName certificate field, for example, +www.example.com and www.example.org. However, the SubjectAltName field length is limited. Another way is to use a certificate with a wildcard name, for example, -*.example.org. This certificate matches -www.example.org, but does not match example.org -and www.sub.example.org. These two methods can also be combined. -A certificate may contain exact and wildcard names in the SubjectAltName field, -for example, example.org and *.example.org. +*.example.org. +This certificate matches www.example.org, but does not match +example.org and www.sub.example.org. +These two methods can also be combined. +A certificate may contain exact and wildcard names in the +SubjectAltName field, for example, +example.org and *.example.org. @@ -336,20 +338,20 @@ its private key file at the http to inherit their single memory copy in all servers: -ssl_certificate common.crt; -ssl_certificate_key common.key; +ssl_certificate common.crt; +ssl_certificate_key common.key; server { - listen 443; - server_name www.example.com; - ssl on; + listen 443; + server_name www.example.com; + ssl on; ... } server { - listen 443; - server_name www.example.org; - ssl on; + listen 443; + server_name www.example.org; + ssl on; ... } @@ -407,10 +409,10 @@ In order to use SNI in nginx, it must be OpenSSL library with which the nginx binary has been built as well as the library to which it is being dynamically linked at run time. OpenSSL supports SNI since 0.9.8f version if it was built with config option -“--enable-tlsext”. +“--enable-tlsext”. Since OpenSSL 0.9.8j this option is enabled by default. If nginx was built with SNI support, then nginx will show this -when run with the “-V” switch: +when run with the “-V” switch: $ nginx -V @@ -438,7 +440,7 @@ therefore SNI is not available -The SNI support status has been shown by the “-V” switch +The SNI support status has been shown by the “-V” switch since 0.8.21 and 0.7.62. diff --git a/xml/ru/docs/http/configuring_https_servers.xml b/xml/ru/docs/http/configuring_https_servers.xml --- a/xml/ru/docs/http/configuring_https_servers.xml +++ b/xml/ru/docs/http/configuring_https_servers.xml @@ -21,13 +21,13 @@ server { - listen 443; - server_name www.example.com; - ssl on; - ssl_certificate www.example.com.crt; - ssl_certificate_key www.example.com.key; - ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; - ssl_ciphers HIGH:!aNULL:!MD5; + listen 443; + server_name www.example.com; + ssl on; + ssl_certificate www.example.com.crt; + ssl_certificate_key www.example.com.key; + ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers HIGH:!aNULL:!MD5; ... } @@ -39,8 +39,8 @@ server { Секретный ключ можно также хранить в одном файле с сертификатом: - ssl_certificate www.example.com.cert; - ssl_certificate_key www.example.com.cert; + ssl_certificate www.example.com.cert; + ssl_certificate_key www.example.com.cert; при этом права доступа к файлу следует также ограничить. @@ -85,7 +85,7 @@ SSL-операции потребляют дополнительные ресурсы процессора. Наиболее ресурсоёмкой для процессора является операция SSL handshake, в рамках которой формируются криптографические параметры сессии. Существует два способа уменьшения числа этих операций, производимых для каждого -клиента: включение постоянных (keepalive) соединений, позволяющих в рамках +клиента: использование постоянных (keepalive) соединений, позволяющих в рамках одного соединения обрабатывать сразу несколько запросов, и повторное использование параметров SSL-сессии для предотвращения необходимости выполнения SSL handshake для параллельных и последующих соединений. @@ -97,25 +97,25 @@ SSL handshake для параллельных и последующих соединений. Он может быть увеличен с помощью директивы . Вот пример конфигурации, оптимизированной под 4-ядерную систему -с 10M разделяемого кэша сессий: +с 10-мегабайтным разделяемым кэшем сессий: -worker_processes 4; +worker_processes 4; http { - ssl_session_cache shared:SSL:10m; - ssl_session_timeout 10m; + ssl_session_cache shared:SSL:10m; + ssl_session_timeout 10m; server { - listen 443; - server_name www.example.com; - keepalive_timeout 70; + listen 443; + server_name www.example.com; + keepalive_timeout 70; - ssl on; - ssl_certificate www.example.com.crt; - ssl_certificate_key www.example.com.key; - ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; - ssl_ciphers HIGH:!aNULL:!MD5; + ssl on; + ssl_certificate www.example.com.crt; + ssl_certificate_key www.example.com.key; + ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers HIGH:!aNULL:!MD5; ... @@ -147,11 +147,11 @@ http { server { - listen 443; - server_name www.example.com; - ssl on; - ssl_certificate www.example.com.chained.crt; - ssl_certificate_key www.example.com.key; + listen 443; + server_name www.example.com; + ssl on; + ssl_certificate www.example.com.chained.crt; + ssl_certificate_key www.example.com.key; ... } @@ -203,8 +203,8 @@ Certificate chain ... -В этом примере субъект (“s”) сертификата №0 сервера -www.GoDaddy.com подписан издателем (“i”), +В этом примере субъект (“s”) сертификата №0 сервера +www.GoDaddy.com подписан издателем (“i”), который в свою очередь является субъектом сертификата №1, подписанного издателем, который в свою очередь является субъектом сертификата №2, подписанного общеизвестным издателем ValiCert, Inc., @@ -224,18 +224,18 @@ Certificate chain Если серверы HTTP и HTTPS идентичны, -можно настроить единый сервер, который обслуживает -как HTTP-, так и HTTPS-запросы. +можно настроить единый сервер, который обслуживает как HTTP-, +так и HTTPS-запросы. Для этого следует исключить директиву “ssl on” и добавить параметр ssl к порту *:443: server { - listen 80; - listen 443 ssl; - server_name www.example.com; - ssl_certificate www.example.com.crt; - ssl_certificate_key www.example.com.key; + listen 80; + listen 443 ssl; + server_name www.example.com; + ssl_certificate www.example.com.crt; + ssl_certificate_key www.example.com.key; ... } @@ -260,23 +260,23 @@ listen 443 default ssl; server { - listen 443; - server_name www.example.com; - ssl on; - ssl_certificate www.example.com.crt; + listen 443; + server_name www.example.com; + ssl on; + ssl_certificate www.example.com.crt; ... } server { - listen 443; - server_name www.example.org; - ssl on; - ssl_certificate www.example.org.crt; + listen 443; + server_name www.example.org; + ssl on; + ssl_certificate www.example.org.crt; ... } -В такой конфигурации браузер получит сертификат первого сервера, т.е. +В такой конфигурации браузер получит сертификат сервера по умолчанию, т.е. www.example.com, независимо от запрашиваемого имени сервера. Это связано с поведением протокола SSL. SSL-соединение устанавливается до того, как браузер посылает HTTP-запрос, @@ -290,18 +290,18 @@ SSL-соединение устанавливается до того, как браузер посылает HTTP-запрос, server { - listen 192.168.1.1:443; - server_name www.example.com; - ssl on; - ssl_certificate www.example.com.crt; + listen 192.168.1.1:443; + server_name www.example.com; + ssl on; + ssl_certificate www.example.com.crt; ... } server { - listen 192.168.1.2:443; - server_name www.example.org; - ssl on; - ssl_certificate www.example.org.crt; + listen 192.168.1.2:443; + server_name www.example.org; + ssl on; + ssl_certificate www.example.org.crt; ... } @@ -311,15 +311,15 @@ server {
+ name="SSL-сертификат с несколькими именами"> Существуют и другие способы, которые позволяют использовать один и тот же IP-адрес сразу для нескольких HTTPS-серверов. Все они, однако, имеют свои недостатки. Одним из таких способов является использование сертификата с несколькими -именами в поле SubjectAltName сертификата, например www.example.comwww.example.org. +именами в поле SubjectAltName сертификата, например +www.example.com и www.example.org. Однако, длина поля SubjectAltName ограничена. @@ -332,7 +332,8 @@ IP-адрес сразу для нескольких HTTPS-серверов. example.org и www.sub.example.org. Два вышеуказанных способа можно комбинировать. Сертификат может одновременно содержать и точное, и wildcard имена в поле -SubjectAltName, например example.org и *.example.org. +SubjectAltName, например +example.org и *.example.org. @@ -341,20 +342,20 @@ SubjectAltName, например example.org и *.example.org. все серверы унаследовали их единственную копию в памяти: -ssl_certificate common.crt; -ssl_certificate_key common.key; +ssl_certificate common.crt; +ssl_certificate_key common.key; server { - listen 443; - server_name www.example.com; - ssl on; + listen 443; + server_name www.example.com; + ssl on; ... } server { - listen 443; - server_name www.example.org; - ssl on; + listen 443; + server_name www.example.org; + ssl on; ... } @@ -410,13 +411,12 @@ Safari 3.2.1 (Windows-версия поддерживает SNI только на Vista и выше); Чтобы использовать SNI в nginx, соответствующая поддержка должна присутствовать как в библиотеке OpenSSL, использованной при сборке -бинарного файла nginx, так и в библиотеке, подгружаемой в момент -работы. +бинарного файла nginx, так и в библиотеке, подгружаемой в момент работы. OpenSSL поддерживает SNI начиная с версии 0.9.8f, если она была -собрана с опцией конфигурации “--enable-tlsext”. +собрана с опцией конфигурации “--enable-tlsext”. Начиная с OpenSSL 0.9.8j эта опция включена по умолчанию. Если nginx был собран с поддержкой SNI, то при запуске nginx с ключом -“-V” об этом сообщается: +“-V” об этом сообщается: $ nginx -V @@ -444,7 +444,7 @@ therefore SNI is not available -Статус поддержки SNI отображается по ключу “-V” +Статус поддержки SNI отображается по ключу “-V” начиная с версий 0.8.21 и 0.7.62.