Can't set two domains to direct to separate root folders

February 4, 2018 1.3k views
Ubuntu Apache

Hello everybody, so basically I have two separate domains, that I’m trying to run on the same droplet, but have both domains navigate to separate root folders, being two separate websites.
I’ve followed this guide to the LETTER:

My sites available folder has the following files: 000-default.conf , , default-ssl.conf , and
So the two domains I’m trying to set up are (which works) and (which navigates to currently for some reason, rather than the root folder I want it to.

Here is what my looks like:
<VirtualHost *:80>
DocumentRoot /var/www/
ErrorLog ${APACHE
CustomLog ${APACHE
LOG_DIR}/access.log combined

The only thing I can imagine is that my 000-default.conf is overriding it?
Here is what that file looks like:

<VirtualHost *:80>

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

<Directory /var/www/html>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined


Do I need to delete this file?

  • Did you run a2ensite? 000-default.conf does not contain a ServerName and will therefor only be used as a fallback.
    Does ls /etc/apache2/sites-enabled list
    DId you reload the apache configuration by running (for example) service apache2 reload?

  • @jnugh Yes I ran a2ensite, it says both sites are running.
    etc/apache2/sites-enabled lists both sites,
    and I did run service apache2 restart

  • Could you post the output of apache2ctl -S?

2 Answers

AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using Set the ‘ServerName’ directive globally to suppress this message.
VirtualHost configuration:
*:80 is a NameVirtualHost
default server (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost (etc/apache2/sites-enabled/
port 80 namevhost (/etc/apache2/sites-enabled/
ServerRoot: “/etc/apache2”
Main DocumentRoot “/var/www/html”
Main ErrorLog: “/var/log/apache2/error.log”
Mutex watchdog-callback: usingdefaults
Mutex rewrite-map: “using
Mutex default: dir=”/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: usingdefaults
PidFile: “/var/run/apache2/”
Define: DUMP
User: name=“www-data” id=33
Group: name=www-data" id=33

  • This looks correct to me. I just notices that your website is served by an nginx, do you use a loadbalancer setup or something similar? It’s probably redirecting everything to

    • It should be served by apache not nginx. I only set up this for apache, I didn’t touch any nginx settings. I’m not using loadbalancer.
      My thought is maybe it’s something in my networking settings?

        • Did you install nginx? If so: you cant run apache and nginx at the same time on the same ip / port. In this case try: sudo service nginx stop && sudo service apache2 start If it works you should probably uninstall nginx.
        • Is pointing to the correct droplet? Or probably an old droplet running nginx? A floating IP or something pointing to another system?
        • Nginx is not running but apache2 is.
          I only have one droplet so that is pointing to the droplet.

          • Whatever happened: The website is now served by apache, and seems to accept you vhost config :) . Something else seems to be broken however. Are you sure sudo service nginx stop && sudo service apache2 start didn’t do the trick?

        • @jnugh what do you mean something seems to be broken?
          For me both domains are still pointing to the same folder, I’m still seeing my page on both domains

@jnugh hm.. do you have any idea why disabling nginx would change the way my css/js folders would work?
I’m not sure how to fix that

  • @jnugh nevermind, i forgot I created a new folder for my delcontedesigns and only placed the HTML file… Duh.. brainfart moment. Thank you so much! I’ll just uninstall nginx.

Have another answer? Share your knowledge.