Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache virtual hosting

Status
Not open for further replies.

bigmatlem

Technical User
Feb 15, 2001
6
US
I need help getting virtutal hosting working. It recognizes only the default web site and ignores the other sites on the system. I'm conserving IP's and am using name based virtual hosting.

I would be willing to e-mail my httpd.conf file to who ever can help me.

Thanks.
 
I run both IP based and name based Vitual Hosts on different servers. I can have a quick look for you if you still need it.

mail your httpd.conf to darren@aits-uk.net

good luck!

Darren
 
I believe you need to create a virtual host for the default server also.
 
Few checks you can quickly make in your httpd.conf. Examples are also shown here on some entries for a single virtual host and whats required in the httpd.conf for it to work. You also will need to run DNS somewhere and at least have the domain to IP mapping. You do not need ARPA ( reverse dns for these virtual domains) unless you
require aliases for your IP to show up. Make sure your resolv.conf is configured to a DNS server that knows the IP mapping for the virtual domains.

Bindaddress * < - this is very important for virtual hosting

ServerName <--- this should be set to your primary site not any virtual domains.

# If you want to use name-based virtual hosts you need to define at
# least one IP address (and port number) for them.
#NameVirtualHost 12.34.56.78:80
NameVirtualHost 12.34.56.78

At the bottom of the httpd.conf file will be your entries for virtual host here is an example. There are tons of options that can be placed within this for such things
and virtual domains using cgi's and the directories associated etc.

<VirtualHost 216.127.155.114>
DocumentRoot /home/somebody/www
ServerName someday.com
ServerAlias ServerAdmin username@someday.com
ErrorLog /home/somebody/log/error_log
</VirtualHost>

Please not this does not show the SSL type of virtual hosting which gets more involved.
If you need more help you can email me at maxit@rcwing.com

Hope this is of help,
Maxit
 
I'm using Apache 1.3.xx on my Win2000 development machine. I have used it successfully as the default server calling perl and Java Servlets (JServ). I now want to set up several 'Virtual Servers' as test sites for different projects.

Although on a small network, I have no DNS server, but have set up the host file with:-

192.9.100.99 homefox

I have tried every combination I can think of to set up Virtual Servers with no joy.

The following represents my httpd.conf setup and some of the variations I've tried:-

#
# Summary of configuration of httpd.conf
#
ServerType standalone
#
# The name of the machine in the hosts file against it's IP address i.e. 192.9.100.99 homefox
#
BindAddress homefox
#
#Tried BindAddress * and 192.9.100.99 - no success!
#
Port 80
#
# Tried ALL and NONE of the following with no success
#
# NameVirtualHost 192.9.100.99
# NameVirtualHost *
# NameVirtualHost homefox
#
#
<VirtualHost 192.9.100.99>
ServerName servlet-tester
DocumentRoot E:/Datafile/ServletTesterWeb
#
#ErrorLog /ServletTesterWeb/logs/error_log
#TransferLog /ServletTesterWeb/logs/access_log
#
ScriptAlias /cgi-bin/ E:/Datafile/ServletTesterWeb/cgi-bin/
Alias /img/ E:/Datafile/ServletTesterWeb/img/
Alias /scripts/ E:/Datafile/ServletTesterWeb/scripts/
</VirtualHost>

<VirtualHost 192.9.100.99>
ServerName contact
DocumentRoot E:/Datafile/Contacts
#
#ErrorLog /Contacts/logs/error_log
#TransferLog /Contacts/logs/access_log
#
ScriptAlias /cgi-bin/ E:/Datafile/Contacts/cgi-bin/
Alias /img/ E:/Datafile/Contacts/img/
Alias /scripts/ E:/Datafile/Contacts/scripts/
</VirtualHost>

All thoughts gratefully received!
 
I am also having major problems with virtual hosting. I am running Apache 1.3.x on Windows NT and need multiple servers. I need to use name-based. I connect to the internet through a dial-up connection. How should I modify my httpd.conf to make virtual servers work on a dynamic ip? I can email my config file if needed. When accessing the main site I can see my pages, but accessing a virtual server gives a &quot;Forbidden: You don't have permission to access / on this server.&quot; error message. Please help!!!
 
For APatchy

Sounds as if your permissions for the virtual host directories are not correct.
They must have read/write permissions which in NT I believe is in the admin
section and you need to make it allowable for others to share or access that
directory. It does not sound like a httpd.conf problem. Again its a permission
problem for the directory.

email direct to maxit@rcwing.com if you need more info
though I do not run NT... I run a linux OS based server.

Maxit
 
Hi,

If you have a dynamic IP address then you can use '*' in place of the IP address on the NameVirtualHost directive and the <VirtualHost> containers. For example :

NameVirtualHost *

<VirtualHost *>
UseCanonicalName Off
ServerName DocumentRoot /var/</VirtualHost>

<VirtualHost *>
UseCanonicalName Off
ServerName DocumentRoot /var/</VirtualHost>


Also remove any 'BindAddress' directive and make sure you have only 'Listen' directives with port numbers - i.e.

Listen 80
Listen 443

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top