[英]Same server, both SSL and non-SSL
Is it possible to have both SSL protocol and non-SSL protocol running on the same server in Apache 2.x? 是否可以在Apache 2.x中的同一台服务器上运行SSL协议和非SSL协议?
So if I access http://example.com
(non-SSL) and https://example.com
(SSL) they would both be available. 因此,如果我访问
http://example.com
(非SSL)和https://example.com
(SSL),它们都将可用。
If so, would I need to create a virtual host? 如果是这样,我是否需要创建虚拟主机? How would this
VirtualHost
directive look like, could anyone give me an example? 这个
VirtualHost
指令会是什么样子,有人能给我举个例子吗? (Assuming I already have the certificates) (假设我已经有证书)
Yes, you simply add another VirtualHost for the same name on port 443 (HTTPS). 是的,您只需在端口443(HTTPS)上为同一名称添加另一个VirtualHost。 Set
SSLProtocol
to whichever protocols you wish to allow. 将
SSLProtocol
设置为您希望允许的任何协议 。
<VirtualHost *:80>
ServerName your-domain.com
DocumentRoot /var/www/your-domain-root
</VirtualHost>
<VirtualHost *:443>
DocumentRoot /var/www/your-domain-root
ServerName your-domain.com
SSLEngine On
SSLOptions +StrictRequire
SSLCertificateFile /path/to/server.crt
SSLCertificateKeyFile /path/to/server.key
SSLProtocol TLSv1
</VirtualHost>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.