Score:1

Set Apache to Block HTTPS Requests to a Certain Subdomain

lt flag

I have these domains

domain.com
www.domain.com
srv.domain.com

pointing to the same server IP, but want my website to be accessible only via domain.com and www.domain.com which have SSL certificates. I run a TCP-based service accessed via srv.domain.com; there is no SSL certificate for it, but currently I can still access the website via this subdomain.

How should I configure Apache so that it blocks HTTPS (and HTTP) requests to this particular subdomain?

My configs look like this:

000-default.conf:

<VirtualHost *:80>
  ServerName domain.com
  ServerAlias www.domain.com
  DocumentRoot /var/www/html
  AllowEncodedSlashes NoDecode

  RewriteEngine on
  RewriteCond %{SERVER_NAME} =domain.com [OR]
  RewriteCond %{SERVER_NAME} =www.domain.com
  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

000-default-le-ssl.conf:

<IfModule mod_ssl.c>
  <VirtualHost *:443>
    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot /var/www/html
    AllowEncodedSlashes NoDecode

    Include /etc/letsencrypt/options-ssl-apache.conf

    <IfModule mod_headers.c>
      Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
    </IfModule>

    SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
  </VirtualHost>
</IfModule>
I sit in a Tesla and translated this thread with Ai:

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.