Virtual Hosts Help

I've copied exactly one of the virtual host declarations in my httpd-vhosts.conf file where the rest of the virtual hosts are and they aren't working.

I'm missing something.

Not working:
Code:
<VirtualHost *:80>
    ServerAdmin re@moved
    DocumentRoot /usr/local/www/private/intranet
    ServerName intranet.babersinc.local
    ErrorLog /usr/local/private-error.log
    CustomLog /usr/local/private-access.log common
</VirtualHost>

Working:
Code:
<VirtualHost *:80>
    ServerAdmin re@moved
    DocumentRoot /usr/local/www/webdev
    ServerName webdev.babersinc.local
    ErrorLog /usr/local/www/webdev-error.log
    CustomLog /usr/local/www/webdev-access.log common
</VirtualHost>
 
When you say 'aren't working', do you mean, Apache wont start, or do you mean Apache starts but does not serve requests for the intranet subdomain?

Some more questions that might help:
  1. Are you naming both files with a .conf postfix? Example intranet.conf and webdev.conf.
  2. Do any of your other Apache configuration files have the following entry somewhere?
    Code:
    NameVirtualHost *:80

    If your NameVirtualHost *:80 doesn't exist, then I believe Apache will only pick up one virtual host entry.
  3. Can Apache write logs to /usr/local/ directory? You have the intranet subdomain configured to write its error and access log files to /usr/local/private-error.log and /usr/local/private-access.log.
 
1. They are all in the same file.
2. As far as I know there all the information is correct the code you provided is in the httpd-vhosts.conf file.
3. I am not sure, however I had the error log in the same directory and it still didn't work. Though I will change that and see if that's the problem.

I think I'm missing something somewhere. Some file somewhere that needs to be updated as well. I've looked in DNS stuff as well and I can't find anything that makes those two subdomains different.
 
Code:
<VirtualHost *:80>
    ServerAdmin re@moved
    DocumentRoot /usr/local/www/private/intranet
    ServerName intranet.babersinc.local
    ErrorLog /usr/local/www/intranet-error.log
    CustomLog /usr/local/www/intranet-access.log common
</VirtualHost>

I changed it and restarted apache. Apache gives no syntax errors so it went through fine.

But when I put intranet.babersinc.local into the browser I get a cannot find server.
 
Code:
; <<>> DiG 9.4.-ESV-R4 <<>> @babersinc.local intranet.babersinc.local
; (2 servers found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 6104
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;intranet.babersinc.local.      IN      A

;; AUTHORITY SECTION:
babersinc.local.        3600    IN      SOA     babersdc.babersinc.local. hostmaster.babers.local. 20827 900 600 86400 3600

;; Query time: 16 msec
;; SERVER: 192.168.200.201#53(192.168.200.201)
;; WHEN: Mon May 21 10:23:34 2012
;; MSG SIZE  rcvd: 120
 
So, this turns out to be a DNS issue.

You can temporarily bypass it by adding the entry in your clients hosts file.
 
Thanks for the help thus far. How would I go about finding out how to resolve this DNS issue?

Our server admin quit many months ago and I have no one to run the server our new IT guy isn't a UNIX guy so he's not much more help than I am.

Any direction you can point me in would be awesome. Thanks in advance.
 
Matalina said:
I get

Code:
** server can't find intranet.babersinc.local: NXDOMAIN

when I do an nslookup?

So the issue is that your workstation/system can not find the intranet.babersinc.local subdomain and convert it to an IP address. Have you added that to your DNS configuration? Most likely the same location were you have webdev.babersinc.local define, or you can also add it as an entry in your /etc/hosts file.
 
Okay, I think that's where my problem is. I can't find where any of the DNS stuff is set up. What would be a possible location? I've checked etc/named.

There are no entries other than localhost in etc/hosts.
 
Matalina said:
Thanks for the help thus far. How would I go about finding out how to resolve this DNS issue?

Our server admin quit many months ago and I have no one to run the server our new IT guy isn't a UNIX guy so he's not much more help than I am.

Any direction you can point me in would be awesome. Thanks in advance.

First of all you have to locate your DNS server. I see from an earlier post:

Matalina said:
Code:
;; AUTHORITY SECTION:
babersinc.local.        3600    IN      SOA     [B]babersdc.babersinc.local[/B]. hostmaster.babers.local. 20827 900 600 86400 3600

So, it appears that you are looking for babersdc box. If this is a FreeBSD system then you can look at the handbook on how to configure / modify the DNS.
If this is some sort of Linux distro, then still the same handbook would help you but you might want to look for the location of the files in a different place.

[CMD=""]# locate named.conf[/CMD]

This would work in most Linux boxes.
 
Back
Top