Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am having a rough time running apache and using multiple domain names

here is a snippet of my config file. I keep getting a error saying that NameVirtualHost has no VirtualHosts. I want them both running on the same IP and I'm not sure why this doesn't work. I've been digging through the documentation for VirtualHosts, NameVirtualHost, and apache's page about name based virtual hosting.

That example in the name based page is almost exactly my config! What am I doing wrong?

Listen 80
NameVirtualHost *:80

<VirtualHost *:80>
   ServerName www.sample1.net
   DocumentRoot /var/www/sample1-net

</VirtualHost>

<VirtualHost *:80>
   ServerName www.example2.net
   DocumentRoot /var/www/example2-net

</VirtualHost>

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

I suspect it's because you have 'listen *:80'. It should be listen 80 or listen 1.2.3.4:80.

share|improve this answer
    
I was still using listen 80 right before upload and was just trying anything and everything at this point. this makes no difference in my testing. –  PsychoData Oct 22 '13 at 16:20
    
Then you're going to have to post more of you config? What Distro are you using? Debian based? Do you have sites enabled in /etc/apache2/sites-enabled? –  Halfgaar Oct 23 '13 at 10:02
    
I'm on centOS. I was not using sites-enabled just loading the virtualhosts directly in etc/httpd/conf/httpd.conf –  PsychoData Oct 23 '13 at 15:20
    
after looking up how sites-available and sites-enabled work moving the config for each site into it's own [site].conf file in -available then making a link to that file in -enabled I still get the same errors. For what it's worth I got no difference whether i was loading the config in httpd.conf, conf.d, or through sites-enabled –  PsychoData Oct 23 '13 at 15:27
    
I would really edit your question if I were you. Correct the *:80 mistake, and add more of your configuration. There is more going on here that we can't see. –  Halfgaar Oct 23 '13 at 19:07
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.