Change the Default Domain of a Shared IP in Plesk

Plesk is a great tool (especially compared to other domain management software), but some things aren’t as straight forward to change.  For example, if you setup a handful of domains on a shared IP, the first domain created on that IP will be it’s default.  So if you go directly to the IP in your browser (not the domain), the first domain that you setup is the one that you will see.  Fortunately, changing this is simple.

Ssh to your domain as root and open /etc/httpd/conf.d/zz010_psa_httpd.conf for editing:

Near the top of the file, find the very first vhosts Include line:

You’ll notice that this is the first domain that you setup and that at the bottom of the file, is where the rest of your domains’ config files are included:

The way that Apache is configured will cause the very first domain config include to be used when a virtual host isn’t specified (by going to the IP instead of the domain).  All you have to do to change this behavior is:

  1. Swap the first Include line with that of the domain you want to be the new IP default domain
  2. Restart Apache

For example, if you want to use domain-c as new your IP default domain, change the first Include to:

Make sure to add domain-a back at the bottom with the rest of the includes, otherwise you’ll break that domain.

Now, all you have to do is restart save the file and restart Apache.

 

Hi there, I'm Justin!

I like to teaching people about programming. Well, yeah, I guess it's obvious, I also like to write. Yes that was a Digital Underground reference.