szatox Advocate

Joined: 27 Aug 2013 Posts: 2020
|
Posted: Sat Jun 30, 2018 6:37 pm Post subject: |
|
|
[Moderator note: this post was originally a response after the thread veered off-topic. The off-topic posts moved to Apache vhosts - quirks and practice, leaving this post as the first and, at the time of the split, only post in this thread. -Hu]
Back to the topic:
Quote: | -default vhost enabled: default website appears. my website is unusable.
-default vhost disabled: no port listening. apache crashes. my website is unusable. |
First, are you going to host more than one website on this machine? AKA do you even have to bother with setting up multiple vhosts?
If not, simply replace the contents of /var/www with your website or replace the path in DocumentRoot with one of your own (the first solution is easier, since you don't have to fix any permissions).
If yes, put the Listen directive in apache.conf instead of vhost definition and add ServerName directive inside every single vhost definition. Every vhost should be named according to the domain it serves. E.g. if you serve domains example.org, you need a directive "ServerName example.org" in exactly one of your vhosts. This is how apache knows which host should serve a particular request.
Without that, the first vhost loaded wins (it also wins if no other vhost matches client's request). Should you split your configuration into multiple files, they will be loaded in lexical order (000-default. goes before aaa-myhost.conf), and every single configuration file must end in .conf or apache will ignore it. |
|