I am new on Debian, Built server on Digital Ocean with Debian OS. I successfully added two domains into one droplet:


Created new dir:


and copied files to public_html

The config file inside /etc/apache2/sites-available is:

DocumentRoot /home/user/www/mysite.com/public_html

<Directory /home/user/www/mysite.com/public_html>
    Options -Indexes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted

ErrorLog ${APACHE_LOG_DIR}/myproject-error.log
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/myproject-access.log combined

Of Course, I enabled the site.

I haven't edited apache2.conf file and haven't configured 2nd domain (anothersite.com). Just added this 2nd domain to droplet, that's all.

When I enter to the site mysite.com it works perfect. Why is the 2nd domain (anothersite.com) redirected to the 1st (mysite.com) domain?

I use Apache 2.4

  • please post the entire <VirtualHost> of your apache config. and what exactly does droplet mean in this context? – umläute Feb 4 '16 at 20:53
  • droplet is just a symbolic name where you build your web server. Do you mean 000-default.conf ? – Rashad Feb 4 '16 at 20:58

If you have a hostname (e.g. anothersite.com) point to the apache webserver but you haven't explicitely configured a <VirtualHost> section that matches that hostname, then apache will deliver a "best match" (the first ).

so if you only have a single <VirtualHost> in your apache config, and multiple hostnames (mysite.com and anothersite.com) point to the same machine, all of these names will display the same virtual host.

  • So, you mean if I have multiple domains I should have multiple VirtualHost? If yes, where it locates? Or you mean config files of each domain, which calls mysite.com.conf, anothersite.com.conf in etc/apache2/site-available? – Rashad Feb 4 '16 at 21:09
  • it's best practice to have one snippet per vhost in your /etc/apache/sites-enabled, each prefixed with a number (so you know which one is the first); but you could also cram all of them into a single conf-file (or have all of the apache configuration in a single file) if you prefer it that way. – umläute Feb 4 '16 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.