Page 1 of 1
configure multiple public_html directories with a single IP
Posted: Tue Jun 14, 2005 2:53 pm
by neophyte
I've got a fresh installation of xampp. (
http://apachefriends.org/en/) Anyway I'd like to configure it to run over a network with more than one web directory(public_html). I only have one ip address. It's been suggested that I run them to different ports. Can someone give me apache directives example for this? Or just how do I go about doing it?
Thanks
Posted: Tue Jun 14, 2005 4:06 pm
by Skara
at the bottom of httpd.conf, there should be something like this:
Code: Select all
<VirtualHost *:80>
ServerName example.com
DocumentRoot /path/to/public_html
</VirtualHost>
Just add another as so (change the 8080 to whatever you want):
Code: Select all
<VirtualHost *:8080>
ServerName example.com
DocumentRoot /path/to/public_html2
</VirtualHost>
To get to that addy, though, the user would have to type in the address bar:
example.com:8080
You should do subdomains instead:
Code: Select all
<VirtualHost *:80>
ServerName subdomain.example.com
DocumentRoot /path/to/subdomain_html
</VirtualHost>
Posted: Tue Jun 14, 2005 4:29 pm
by neophyte
The problem is I don't have a dns or .com address. It's localhost with a single IP over a n intranet.
I've gotten it to work so far with this:
Code: Select all
#First tell apache to listen to a port
Listen 8080
...
#Tell it what port to get
<VirtualHost 192.168.0.100:8080>
ServerName 192.168.0.100:8080
DocumentRoot c:/webserver/xampp/htdocs/xampp/rwu/www
</VirtualHost>
My only problem is that when I hit
http://192.168.0.100:8080/ it doesn't load index.php. It tries to load xampp/splash.php -- Any clues where to look to get rid of this annoying option? What directive would make this happen. I don't think the above works with localhost in place of the ip address.
Posted: Tue Jun 14, 2005 4:31 pm
by Skara
ah. you can get a domain as cheap as 4 USD per year.
Using an IP shouldn't change it, though.
Code: Select all
<VirtualHost 192.168.0.100:8080>
ServerName 192.168.0.100
DocumentRoot c:/webserver/xampp/htdocs/xampp/rwu/www
</VirtualHost>
You don't need the port again on ServerName.
Just so you know (I'm sure you do), this is only accessible via your local network. 192.* is a local IP.

Posted: Tue Jun 14, 2005 4:35 pm
by neophyte
Yup, I'm just interested in setting this up for a test environment.
Posted: Tue Jun 14, 2005 4:43 pm
by neophyte
Any ideas of what directive to look at to make index.php the default instead of xampp/splash.php?
Posted: Tue Jun 14, 2005 5:15 pm
by Chris Corbyn
I suggest you get an account with no-ip.org (it's free) and then set up virtual hosts by name.
That's easy too (you can have them all on port 80 like they should be).
Code: Select all
NameVirtualHost *:80
<VirtualHost *:80>
ServerName daliup.no-ip.org
DocumentRoot /home/daliup/public_html/
</VirtualHost>
<VirtualHost *:80>
ServerName corbyn.no-ip.org
DocumentRoot /srv/www/htdocs/
</VirtualHost>
<VirtualHost *:80>
ServerName w3style.co.uk
ServerAlias www.w3style.co.uk
DocumentRoot /home/d11wtq/public_html/.w3style_files/
</VirtualHost>
Posted: Tue Jun 14, 2005 5:17 pm
by Chris Corbyn
neophyte wrote:Any ideas of what directive to look at to make index.php the default instead of xampp/splash.php?
Code: Select all
# List of resources to look for when the client requests a directory
DirectoryIndex index.php index.php3 index.html index.htm index.pl
Posted: Tue Jun 14, 2005 8:07 pm
by neophyte
Thanks for the tips all!
Posted: Wed Jun 15, 2005 1:00 am
by timvw
Btw, you don't need to buy domain name(s).
Simply edit your /etc/hosts or c:/windows/system32/drivers/etc/hosts
Now i can surf to localhost and to test
Code: Select all
NameVirtualhost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot "e;F:/websites/localhost"e;
<Directory "e;F:/websites/localhost"e;>
AllowOverride All
Options All
</Directory>
</Virtualhost>
<VirtualHost *:80>
ServerName test
DocumentRoot "e;F:/websites/test"e;
<Directory "e;F:/websites/test"e;>
AllowOverride All
Options All
</Directory>
</Virtualhost>