Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Dec 2005 06:37:34 -0800
From:      "Edwin D. Vinas" <xmisoy@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   FreeBSD/Apache/DNS- Problem accessing virtual hosts from external network
Message-ID:  <36f5bbba0512180637h1da3dc78qab0d9c1ad0b018f5@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,

I am using DNS(Bind)/Apache(virtual hosting) in a FreeBSd machine which is
connected via a static IP in a DSL provider. I want to setup mulitple
websites under my domain. I have been able to get a domain from GoDaddy and
was able to setup so that it will point to my IP address when my domain is
accessed. I also have configured DNS and Apache virtual hosting.

 Questions:
1) Is it a problem of DNS, Apache virtual hosting or my domain name
provider?
2) Is anyone have tried to configure multiple virtual hosting in Apache wit=
h
DNS in one FreeBSD machine? Can you give me your sample config for DNS,
Apache, /etc/hosts/, /etc/resolv.conf etc etc that are related to this
setup?

-----------------------------------
Observations:
1) If the computer accessing the virtual domains  is from the LAN, it works
fine. I can access
all the virtual domains (i.e., www.mydomain.com, vhost1.mydomain.com,
vhost2.mydomain.com, vhost3.mydomain.com)
2) But if the virtual domain was accessed from outside (Internet or at my
office), it doesn't work and all virtual domains
resolve to www.mydomain.com. All I can see is the main default page for
www.mydomain.com.  For example, when I access www.mydomain.com, it works
fine. But when I access the virtual hosts
such as vhost1.mydomain.com, vhost2.mydomain.com, vhost3.mydomain.com; it
only display the main website www.mydomain.com.


Here are my configurations:
----
* httpd.conf & virtual hosts
#--
Listen 80
BindAddress 203.xxx.xxx.xxx
Port 80
#ServerName www.mydomain.com (commented it out but doesn't have any effect
when uncommented)

DocumentRoot "/usr/local/apache/www"

<Directory "/usr/local/apache/www">

NameVirtualHost 203.xxx.xxx.xxx:80

<VirtualHost 203.xxx.xxx.xxx:80>
    ServerAdmin mymail@gmail.com
    DocumentRoot /usr/local/apache/www/
    ServerName www.mydomain.com
    ErrorLog logs/virtual_host.www.com-error_log
    CustomLog logs/virtual_host.www.com-access_log common
</VirtualHost>


<VirtualHost 203.xxx.xxx.xxx:80>
    ServerAdmin mymail@gmail.com
    ServerName vhost1.mydomain.com
    DocumentRoot /usr/local/apache/www_virtual/vhost1/
    ErrorLog logs/virtual_host.vhost1.com-error_log
    CustomLog logs/virtual_host.vhost1.com-access_log common
</VirtualHost>

<VirtualHost 203.xxx.xxx.xxx:80>
    ServerAdmin mymail@gmail.com
    ServerName vhost2.mydomain.com
    DocumentRoot /usr/local/apache/www_virtual/vhost2/
    ErrorLog logs/virtual_host.vhost2.com-error_log
    CustomLog logs/virtual_host.vhost2.com-access_log common
</VirtualHost>
#---

* DNS configs
#---
; Machine Names
localhost       IN A    127.0.0.1
dns             IN A    203.xxx.xxx.xxx
@               IN A    203.xxx.xxx.xxx

; Aliases
www             IN CNAME        @
vhost1             IN CNAME        @
vhost2      IN CNAME        @
vhost3           IN CNAME        @
vhost4         IN CNAME        @
#---


* Traceroutes from external network
I can traceroute www.mydomain.com and resolves to 203.xxx.xxx.xxx
I can also traceroute vhost1.mydomain.com and resolves to 203.xxx.xxx.xxx
I can also traceroute all vhosts and they find my IP address 203.xxx.xxx.xx=
x
.

* GoDaddy COnfig
- I have set Custom Name Servers and added my IP address/hostname as the DN=
S
server
Thanks!
Edwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36f5bbba0512180637h1da3dc78qab0d9c1ad0b018f5>