Prevent using ip hostname

Discussion in 'Installation/Configuration' started by Arcadeguy, Nov 5, 2025.

  1. Arcadeguy

    Arcadeguy New Member

    I have a server (sites.xxxxx.com) and I created a site within ISPConfig with that name so that if the default url is used it will go to that site just so it doesn't just show the default apache2 page. The problem is that if using the ip address (i.e. <urlscheme>://123.1.1.2) it shows the same page, but SSL is invalid. Or <scheme>://123.1.12:8080 works as well with broken SSL, which is causing me issues with PCI compliance. Ideally I'd like to just prevent direct IP hostname (even if it was just for the ispconfig site), but every solution I've tried does not work (i.e. Vhost with Ip and rewrite, .htaccess with rewrite). Best I've accomplished is redirecting http -> https.
     
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Why not simply redirect the IP to your server site? You know you can create a website using that IP then permanently redirect it to your server site, right? Sorry, if this idea is wrong.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Apache shows the first site in alphabetical order that it finds if no better matching site is there. To show a specific site, e.g. a empty placeholder site, all you have to do is to create a site that is first in alphabet. E.g. create a site with domain '000default.tld', the domain does not has to exist, and create a self-signed cert so it also catches requests for https.
     
  4. remkoh

    remkoh Active Member HowtoForge Supporter

    NEVER EVER create a website with the same hostname as the servername in ispconfig!
    It will break ispconfig's server certificate (which is used by several services like postfix, dovcot, pure-ftpd etc.) that was created during install! The server certificate will not renew anymore and services using it will run into all kinds of issues when the server certificate has expired!

    When it comes to https requests and unknown hostnames in Apache's vhost configs Till is correct in saying the first alphabetically ordered website will be displayed. The alphabetical order are the filenames in /etc/apache2/sites-enabled/.

    The easiest way to get around that is to rename default-ssl.conf to 000-default-ssl.conf in /etc/apache2/sites-enabled/, set ispconfig's server certificate and key (/usr/local/ispconfig/interface/ssl/ispserver.crt and .key) in that file if it isn't already and place the website you want displayed in /var/www/html/.
    Than every https request to an unknown hostname will display that website with proper ssl.

    These steps have been proven to be ispconfig update proof.
     

Share This Page