Question

VHOST on Debian 9 not working

Hi everybody,

I’ve got a Debian 9 wth ISPConfig 3 installed and the vhost doesn’t seem to work, my droplet’s address is tikiwebdev.tk, when I type tikiwebdev.tk I get forwarded to the correct web folder, but I have another domain: alexdownunder.tk, when I type this address I get forwarded to tikiwebdev’s web folder. I’ve got another web server with ISPConfig installed and I don’t have that problem.

I’ve created the domain on the Digital Ocean admin panel, redirecting to the IP of the server (for both domains). Here is the result of the apache2ctl -S command:

VirtualHost configuration:
167.99.225.23:80       tikiwebdev.tk (/etc/apache2/sites-enabled/100-tikiwebdev.tk.vhost:7)
167.99.225.23:443      tikiwebdev.tk (/etc/apache2/sites-enabled/100-tikiwebdev.tk.vhost:92)
*:8081                 tikiwebdev.tk (/etc/apache2/sites-enabled/000-apps.vhost:9)
*:8080                 tikiwebdev.tk (/etc/apache2/sites-enabled/000-ispconfig.vhost:9)
*:80                   is a NameVirtualHost
         default server tikiwebdev.tk (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost tikiwebdev.tk (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost alexdownunder.tk (/etc/apache2/sites-enabled/100-alexdownunder.tk.vhost:7)
                 alias www.alexdownunder.tk
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex fcgid-pipe: using_defaults
Mutex authdigest-opaque: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex authdigest-client: using_defaults
Mutex fcgid-proctbl: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: ENABLE_USR_LIB_CGI_BIN
User: name="www-data" id=33
Group: name="www-data" id=33

I cannot seem to understand what is wrong as the vhost conf files between the two ISPConfig servers are identical but it works on one but not the other.

Thank you!

Subscribe
Share

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

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.

My suggestion will be to start with something small and then add additional lines of code to identify where exactly the issue starts.

First off, I’m not sure the code above is formatted well.

For a virtual host to serve docs from another directory, you’ll need to declare a DocumentRoot in the virtual host.

<VirtualHost *:80>
    DocumentRoot "/var/www/html/domain1"
    ServerName domain1.com
    ServerAlias www.domain1.com
</VirtualHost>


<VirtualHost *:80>
    DocumentRoot "/var/www/html/domain2"
    ServerName domain2.com
    ServerAlias www.domain2.com
</VirtualHost>