scottybwoy Posted March 30, 2009 Share Posted March 30, 2009 Hi, I'm trying to set up 2 Virtual hosts in apache2 on kubuntu 8.10. I have all the conf files and the symlinks in sites-enabled set up but I get this error: VirtualHost www.pu.com:0 overlaps with VirtualHost www.test.com:0, the first has precedence, perhaps you need a NameVirtualHost directive Do I need to set up NamedVirtualHosts? I tried changing <VirtualHost xx.com> to <NameVirtualHost *:80> for default / pu / test .conf files but it didn't like it. Any ideas, at the mo all 3 urls point to pu.com dir. Quote Link to comment https://forums.phpfreaks.com/topic/151807-multiple-virtual-hosts/ Share on other sites More sharing options...
corbin Posted March 30, 2009 Share Posted March 30, 2009 http://httpd.apache.org/docs/2.2/vhosts/examples.html Quote Link to comment https://forums.phpfreaks.com/topic/151807-multiple-virtual-hosts/#findComment-797184 Share on other sites More sharing options...
scottybwoy Posted March 30, 2009 Author Share Posted March 30, 2009 Thanks Corbin, That looks great, but I don't understand ;p Where do I put : # Ensure that Apache listens on port 80 Listen 80 # Listen for virtual host requests on all IP addresses NameVirtualHost *:80 I tried in default.conf in sites available, and in apache2.conf but I get this error : NameVirtualHost *:80 has no VirtualHosts (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs Sorry for not getting it. Quote Link to comment https://forums.phpfreaks.com/topic/151807-multiple-virtual-hosts/#findComment-797284 Share on other sites More sharing options...
corbin Posted March 31, 2009 Share Posted March 31, 2009 You don't need a second Listen statement. Example: NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /www/example1 ServerName www.example.com # Other directives here </VirtualHost> <VirtualHost *:80> DocumentRoot /www/example2 ServerName www.example.org # Other directives here </VirtualHost> That's all there is to it. Quote Link to comment https://forums.phpfreaks.com/topic/151807-multiple-virtual-hosts/#findComment-797394 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.