Я хочу включить поддержку в Apache нескольких виртуальных хостов и сертификатов SSL на одном IP-адресе.
Мой файл конфигурации выглядит следующим образом. Пожалуйста, помогите мне:
NameVirtualHost 196.196.1.117:443
NameVirtualHost 196.196.1.117:80
#Site Configuration on Port 80
<VirtualHost 196.196.1.117:80>
DocumentRoot "/usr/local/tomcat/webapps/ROOT"
ServerName sample_Site
ServerAlias w3.sample.com
ServerAdmin www.w3.sample.com
ErrorLog /var/log/apache2/site-error_log
CustomLog /var/log/apache2/site-access_log combined
<Directory "/usr/local/tomcat/webapps/ROOT">
AllowOverride All
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>
JkMount /* worker1
DirectoryIndex home.xhtml
Redirect /mb https://196.196.1.117/mb
ErrorDocument 400 /error.xhtml
ErrorDocument 401 /error.xhtml
ErrorDocument 403 /error.xhtml
ErrorDocument 404 /error.xhtml
ErrorDocument 405 /error.xhtml
ErrorDocument 408 /error.xhtml
ErrorDocument 410 /error.xhtml
ErrorDocument 411 /error.xhtml
ErrorDocument 412 /error.xhtml
ErrorDocument 413 /error.xhtml
ErrorDocument 414 /error.xhtml
ErrorDocument 415 /error.xhtml
ErrorDocument 500 /error.xhtml
ErrorDocument 501 /error.xhtml
ErrorDocument 502 /error.xhtml
ErrorDocument 503 /error.xhtml
ErrorDocument 506 /error.xhtml
</VirtualHost>
#Site Configuration on Port 443
<VirtualHost 196.196.1.117:443>
DocumentRoot "/usr/local/tomcat/webapps/ROOT"
ServerName sample_Site
ErrorLog /var/log/apache2/HttpsSite_error_log
CustomLog /var/log/apache2/Https-accessSite_log combined
<Directory "/usr/local/tomcat/webapps/ROOT">
SSLRequireSSL
Order Deny,Allow
Allow from All
</Directory>
JkMount /* worker1
DirectoryIndex home.xhtml
ErrorDocument 400 /error.xhtml
ErrorDocument 401 /error.xhtml
ErrorDocument 403 /error.xhtml
ErrorDocument 404 /error.xhtml
ErrorDocument 405 /error.xhtml
ErrorDocument 408 /error.xhtml
ErrorDocument 410 /error.xhtml
ErrorDocument 411 /error.xhtml
ErrorDocument 412 /error.xhtml
ErrorDocument 413 /error.xhtml
ErrorDocument 414 /error.xhtml
ErrorDocument 415 /error.xhtml
ErrorDocument 500 /error.xhtml
ErrorDocument 501 /error.xhtml
ErrorDocument 502 /error.xhtml
ErrorDocument 503 /error.xhtml
ErrorDocument 506 /error.xhtml
SSLEngine on
#SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCipherSuite ALL:!ADH:!EXPORT56:+SSLv3:TLSv1
SSLCertificateFile /etc/apache2/ssl.crt/sb24.crt
SSLCertificateKeyFile /etc/apache2/ssl.key/sb24.key
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/srv/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog /var/log/apache2/ssl_request_log ssl_combined
SetEnv HTTPS on
SetEnv SERVER_PORT 443
</VirtualHost>
#Admin Configuration on Port 443
<VirtualHost 196.196.1.117:443>
DocumentRoot "/usr/local/tomcat1/webapps/SB24_Admin"
ServerName SB24Admin
ErrorLog /var/log/apache2/admin_error_log
CustomLog /var/log/apache2/admin-access_log combined
<Directory "/usr/local/tomcat1/webapps/SB24_Admin">
SSLRequireSSL
Order Deny,Allow
Allow from All
</Directory>
JkMount /* worker2
DirectoryIndex home.xhtml
ErrorDocument 400 /error.xhtml
ErrorDocument 401 /error.xhtml
ErrorDocument 403 /error.xhtml
ErrorDocument 404 /error.xhtml
ErrorDocument 405 /error.xhtml
ErrorDocument 408 /error.xhtml
ErrorDocument 410 /error.xhtml
ErrorDocument 411 /error.xhtml
ErrorDocument 412 /error.xhtml
ErrorDocument 413 /error.xhtml
ErrorDocument 414 /error.xhtml
ErrorDocument 415 /error.xhtml
ErrorDocument 500 /error.xhtml
ErrorDocument 501 /error.xhtml
ErrorDocument 502 /error.xhtml
ErrorDocument 503 /error.xhtml
ErrorDocument 506 /error.xhtml
SSLEngine on
#SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCipherSuite ALL:!ADH:!EXPORT56:+SSLv3:TLSv1
SSLCertificateFile /etc/apache2/ssl.crt/sb24.crt
SSLCertificateKeyFile /etc/apache2/ssl.key/sb24.key
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/srv/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog /var/log/apache2/ssl_request_log ssl_combined
SetEnv HTTPS on
SetEnv SERVER_PORT 443
</VirtualHost>
Это можно сделать, только если и ваш сервер, и веб-браузер поддерживают указание имени сервера (SNI). Смотрите эту страницу Apache для деталей.
http://httpd.apache.org/docs/2.2/ssl/ssl_faq.html#vhosts2
Если вы не используете последнюю версию Apache (выше 2.2.12), вы не можете запускать несколько сайтов SSL с разными сертификатами SSL на одном и том же IP-адресе и порту (443).
Используйте gnutls, а не SSL Подробности см. На этой странице
Кроме того, некоторые обратные прокси позволяют делать то же самое.
есть также опция SSL с подстановочными знаками, однако это полезно только для таких виртуальных хостов;
subdomain1.mybadger.com
subdomain2.mybadger.com
subdomain3.mybadger.com