Apache blocking all request

My apache configuration seems a bit weird. I have three applications running on 3 domains with the same IP. Now I have 3 conf files like this:

<VirtualHost *:80>
  ServerName app.domain.com:80

  # Redirect any non HTTPS requests to the HTTPS server
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^.*$ [NC]
  RewriteRule ^(.*)$ https://app.domain.com$1 [R=301,L]
</VirtualHost>

<VirtualHost *:443>
  ServerName app.domain.com:443

  SSLCertificateFile [...]/fullchain.pem
  SSLCertificateKeyFile [...]/privkey.pem
  Include /etc/letsencrypt/options-ssl-apache.conf

  # ... application
</VirtualHost>

This works (kinda, there are problems when running collabora for nextcloud, might be an issue outside apache though).
Except now when I access the IP address directly, I get one of the applications, which I don’t want. So I tried to apply the solution mentioned here, but then all access to any domain gets blocked.

What am I doing wrong here?

Answer

Do you have DNS Name set correctly set for all 3 sites pointing to your host.

It will not work until you have correct DNS set correctly.

Attribution
Source : Link , Question Author : yspreen , Answer Author : Chandan Singh

Leave a Comment