Score:0

Apache2 SSL only works when virtualhost is removed?

us flag

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!

Chris avatar
it flag
Not related to your issue but FYI `Order Allow,Deny Allow from all` is apache 2.2 synthax. You should now use `Require all granted`
SparrowTheNerd avatar
us flag
Duly noted, thanks!
Score:0
us flag

Turns out I was an idiot, and forwarded my internal port 80 to external port 443 so the server was receiving HTTP requests instead of HTTPS and throwing the error.

Score:0
us flag

You shouldn't have an IP address in your VirtualHost directive. You should let Apache bind to all interfaces there:

<VirtualHost *:443>
SparrowTheNerd avatar
us flag
Unfortunately that doesn't fix the issue
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.