How to configure different websites (different ports) using Apache

phillydog

Senior member
Dec 19, 2001
472
0
0
I am using the latest Apache 2.x.

I can get the default port 80 running, but I don't add any IP addresses, since using DHCP.

Can someone give me some code to put into the httpd.conf file to create a new website (in addition to the defaulted port 80), but this one on port 523 is an entirely seperate site with the following:

port = 523
home dir = /usr/site523
(webalias) ibi_html = /usr/ibi_html

I am confused and think I use the VirtualHost tag, but all doc I find tells me I need an IP, which I can't provide since I am on DHCP.

It shouldn't matter, but this is on RedHat Linux 9. From what I was told, Apache config files are the same on Windows / Linux / various flavors of Unix.

ANY help is appreciated.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
It's been a while since I did Virtual Hosts, and I don't think I have any notes left over from it. :(

### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them.
# Please see the documentation at <URL:http://www.apache.org/docs/vhosts/>
# for further details before you try to setup virtual hosts.
# You may use the command line option '-S' to verify your virtual host
# configuration.

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


#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
#
<VirtualHost *> #May want *:253 or whatever, can't remember, just test :)
ServerAdmin webmaster@i.dont.read.docs.com
DocumentRoot /www/docs/i.dont.read.docs.com
ServerName i.dont.read.docs.com
ErrorLog logs/i.dont.read.docs.com-error_log
CustomLog logs/i.dont.read.docs.com-access_log common
</VirtualHost>

#<VirtualHost _default_:*>
#</VirtualHost>


http://httpd.apache.org/docs/vhosts/name-based.html for more information.

EDIT: Oh, and using name based virtual hosting, you shouldn't have to fiddle with ports. :p and what is bolded up there is my comment. :)