I'm making a website hosted at sparrowthenerd.space, and I'm trying to have it use multiple subdomains so I can run NextCloud, OctoPrint, and a general webpage all from the same IP address. As I understand, this can be accomplished with VirtualHosts in Apache2. However, unless I remove the virtualhost tag from my conf file (below), I get an SSL Handshake Error with CloudFlare enabled, and an SSL protocol error without it.
I am using Apache2 v2.4.52 on Debian 11 Bullseye. The web server is self-hosted, and uses NodeJS on port 9999 by proxy (I think that's the right terminology?).
#<VirtualHost xxx:xx:xx:xxx:443>
ServerAdmin webmaster@localhost
ServerName sparrowthenerd.space
DocumentRoot /var/www/sparrowthenerd
ProxyPass /.well-known/ !
ProxyPass / http://localhost:9999/
ProxyPassReverse / http://localhost:9999/
ProxyPreserveHost On
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLCertificateFile /etc/apache2/ssl/sparrowthenerd.space.pem
SSLCertificateKeyFile /etc/apache2/ssl/sparrowthenerd.space.key
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www>
AllowOverride none
Order Allow,Deny
Allow from all
</Directory>
#</VirtualHost>
When the virtualhost tags are uncommented, I get the error. When they are commented, I do not, but I also then can't add extra subdomains. I am using the CloudFlare proxy servers with a Cloudflare SSL Certificate. Please let me know if you need more information, I'm happy to provide it!
Best Answer
You shouldn't have an IP address in your
VirtualHost
directive. You should let Apache bind to all interfaces there: