我尝试为 Linux 中配置的虚拟主机之一配置 SSL(443),该虚拟主机具有相同的域名和不同的端口号,我已使用 mod_ssl 来配置 https。对于具有 https 的虚拟主机 80,它工作正常。现在的问题是,我在端口号 8081 和 8082 上配置了另一个虚拟主机,我想为配置为 8081 和 8082 的虚拟主机提供 HTTPS。
端口号为 8081 和 8082 的站点可以运行,但我需要这些端口能够与 https 配合使用
有人可以帮我吗?
我已尝试以下配置:
<VirtualHost *:443 *8081>
ServerName Test.domain.com
SSLProxyEngine on
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
DocumentRoot /var/www/html/test/
</VirtualHost>
<VirtualHost *:443 *8082>
ServerName Test.domain.com
SSLProxyEngine on
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
DocumentRoot /var/www/html/test2/
</VirtualHost>
答案1
Listen 443
Listen 8081
Listen 8082
<VirtualHost 127.0.0.1:8081>
ServerName Test.domain.com
SSLProxyEngine on
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
DocumentRoot /var/www/html/test/
</VirtualHost>
<VirtualHost 127.0.0.1:8082>
ServerName Test.domain.com
SSLProxyEngine on
SSLEngine on
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
DocumentRoot /var/www/html/test2/
</VirtualHost>
请参阅VirtualHost的更多示例:https://httpd.apache.org/docs/2.4/vhosts/examples.html