-1

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>

PsychoData
  • 151
  • 9

1 Answers1

3

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

Halfgaar
  • 8,084
  • 6
  • 45
  • 86
  • 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
  • I'll post more after I get off of work. – PsychoData Oct 23 '13 at 22:13