Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How am I supposed to be able to use vhosts?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Gooberpatrol66
Tux's lil' helper
Tux's lil' helper


Joined: 20 Jul 2014
Posts: 86

PostPosted: Fri Jun 29, 2018 7:53 am    Post subject: How am I supposed to be able to use vhosts? Reply with quote

I followed the instructions on the wiki to put my website in a vhost. But I ran into a problem:
-default vhost enabled: default website appears. my website is unusable.
-default vhost disabled: no port listening. apache crashes. my website is unusable.
How does this work?
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1717

PostPosted: Sat Jun 30, 2018 6:37 pm    Post subject: Reply with quote

[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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum