Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Sep 1999 18:30:43 +0100
From:      Adam Nealis <adamn@csl.com>
To:        Langa Kentane <evablunted@earthling.net>
Cc:        FreeBSD <Freebsd-questions@FreeBSD.ORG>
Subject:   Re: apache & virtual servers question
Message-ID:  <37F0FB43.2D4FDD3C@csl.com>
References:  <06f001bf0989$dd3b16f0$36a8ef9b@sunnet.co.za>

next in thread | previous in thread | raw e-mail | index | archive | help
Langa Kentane wrote:
> 
> Hi y'all.  I have an alias address for my ed1 (e .g 192.168.1.3) to which
> apache is bound.  All my virtual servers run off this address.  Now the
> problem that I have is that there are two vitural servers (non IP intensive)
> that I want to create that will be listen only on port 8080 coz I don't was
> and when apache answers, only those two virtual servers must answer.  The
> reason for this is coz the one is running MRTG and the web server is sitting
> behind a firewall and I don't want anyone to be able to view this and at the
> same time port 8080 is hiding behind the firewall.
> 
> Any suggestion?
> 
> I was thinking if creating another alias address of my servers and bind
> apache to 8080 on that address then dns must poing to that address for those
> two servers.  But then again the thing is that I was to do this without
> using another IP address.  Can this be done.  The number of IP's I have is
> limited.
You don't need to use up IP addresses in order to get multiple virtual hosts.
You can have as many httpds as you wish running off the same IP address.

You need to construct your apache.conf on the following lines:

...

Port 80

Listen 80
Listen 8080

...

NameVirtualHost 120.121.122.123

...

<VirtualHost 120.121.122.123:80>
ServerAdmin webmaster@my.domain
DocumentRoot /webbery/www1.my.domain
UseCanonicalName off
ServerName www1.my.domain
ErrorLog /var/log/httpd/error1-.log
TransferLog /var/log/httpd/web1.log
</VirtualHost>

<VirtualHost 120.121.122.123:8080>
ServerAdmin webmaster@my.domain
DocumentRoot /webbery/www2.my.domain
UseCanonicalName off
ServerName www2.my.domain
ErrorLog /var/log/httpd/error2-log
TransferLog /var/log/httpd/web2-log
</VirtualHost>

For this to work, make sure you don't have _any_ web server definitions that
are not contained within

<VirtualHost>  </VirtualHost> pairs. The Port 80 is the default port, the Listen
lines allow >1 port to run of the same machine.

Thus, to get more than one server running off the same IP address, use the IP address
in your NameVirtualHost directive, and refer to IP-address:Port in your VirtualHost
definitions.

NB: The ServerName directive must be a known DNS host.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?37F0FB43.2D4FDD3C>