How to park domains using ISPConfig

How to park domains using ISPConfig

This tutorial explains how to setup a specific default webpage in a working Apache ISPConfig server.eval(ez_write_tag([[728,90],’howtoforge_com-box-3′,’ezslot_4′,106,’0′,’0′]));

Default web pages are useful for different purposes including the parking of domains/subdomains. For example, a domain/subdomain whose A / AAAA DNS records point to the server and it has no website / virtual host serving for it.

In ISPConfig implementations, this would mean that there are DNS records for a given domain name without configured websites.eval(ez_write_tag([[580,400],’howtoforge_com-medrectangle-3′,’ezslot_1′,121,’0′,’0′]));

Recommendations and prerequisites

This tutorial assumes that you have a working Apache ISPConfig server and for the default website a valid internet domain name with A / AAAA records pointing to the server.

Before continuing it is important to mention the Server Name Indication TLS protocol extension, which enables the identification of HTTPS sites by its domain/subdomain name. Because some old browsers are incompatible with SNI, it is recommended that the default website supports both HTTP and HTTPS. It is also recommended that it supports IPv4 and IPv6 connectivity.

There is one advantage of implementing a default website as described by this tutorial: ISPConfig server monitors Apache each five minutes requesting the site localhost. With a shorter answer for site localhost the traffic load for the network interface lo will be decreased. This is a small resources optimization and many small optimizations are comparable to a big one.

For redirecting all parked domain requests to a specific URL mod_rewrite is required.

1 Create the default website

In case you have already created the website that you desire as default, then you may jump to the fifth step.

  1. Go to Sites module.
  2. Click on Add new website.
  3. In Domain field write a valid internet domain name: yourdomain.tld
  4. Change the other options at will, giving special attention to SSL and Let’s encrypt SSL following the previous recommendations.
  5. Uncheck the Active box.

2 Configure redirection to a specific URL (optional)

It is recommended to redirect all traffic coming from parked domains to a specific URL showing a personalized text for expressing: This domain is parked here.

  1. Go to the Options tab.
  2. Add these Apache Directives replacing the bolded parts:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^yourdomain.tld$
  3. Add any subdomain/website alias as follows:
    RewriteCond %{HTTP_HOST} !^www.yourdomain.tld$
    RewriteCond %{HTTP_HOST} !^domainalias.tld$
  4. Replace parked.html with a valid URL:
    RewriteRule ^ http://yourdomain.tld/parked.html [L,R=302]
  5. Click on Save button.

3 Include the virtual host file manually

It is recommended that your default website has SSL enabled in order to serve the same default website for HTTP port number 80 and HTTPS port number 443.

Please remember that because the virtual host file is included manually, the default website should be disabled in ISPConfig.

Edit the apache configuration file adding the below line before any inclusion for virtual hosts and replace yourdomain.tld accordingly:

IncludeOptional sites-available/yourdomain.tld.vhost

Real life example of ISPConfig productive server:

#Debian based systems
editor /etc/apache2/apache.conf
IncludeOptional sites-available/
IncludeOptional sites-enabled/*.vhost
#Red Hat and SUSE based systems
editor /etc/httpd/conf/httpd.conf
IncludeOptional sites-available/
IncludeOptional sites-enabled/*.vhost

And then reload the apache configuration files running:

#init.d based init system
/etc/init.d/apache2 reload
#systemd as init system
systemctl reload apache2

4 Test default website and localhost

You may use the Linux command netcat to request an answer for localhost and yourdomain.tld:

printf 'GET / HTTP/1.1\r\nHost:yourdomain.tld\r\n\r\n' | netcat yourdomain.tld 80
printf 'GET / HTTP/1.1\r\nHost:localhost\r\n\r\n' | netcatyourdomain.tld 80
About the Author

Leave a Reply