Multiple domains on one droplet (multiple vhosts issue)

Hi folks,

I have added two domains to my droplet ( and – both seem to be set up correctly.

I’m then running from the /var/www/html/ directory and from the /var/www/ directory. I also have a sub-domain set up which seems to be working fine.

I have just added a file to /etc/apache2/sites-available, and enabled the .conf file using a2ensite and this is what it contains:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/

        <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted

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

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.cgi index.html index.xhtml index.htm

RewriteEngine on
RewriteCond %{SERVER_NAME}
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

However it seems to be showing the contents of /var/www/html/ and not /var/www/

I have ran a apache2ctl -S command and this is the output:

root@dev:~# apache2ctl -S
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:
*:443                  is a NameVirtualHost
         default server (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2)
         port 443 namevhost (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2)
         port 443 namevhost (/etc/apache2/sites-enabled/
*: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: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl 
Mutex mpm-accept: using_defaults
PidFile: "/var/run/apache2/"
User: name="www-data" id=33
Group: name="www-data" id=33
Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


Indeed as azaraks you could try creating a Vhost for port 443. In order to do that you would need an SSL certificate.

I would suggest just using Let’s Encrypt and certbot, that way certbot would generate the Vhost for port 443 automatically for you.

You could follow the steps on how to do that here:

Regards, Bobby

This comment has been deleted