View previous topic :: View next topic |
Author |
Message |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Thu Jul 22, 2004 5:41 am Post subject: |
|
|
You can associate 127.0.0.1 with each of those names, but then you would still have to type myname/myname. It would only work perfectly if you ran Abyss on 4 different ports:
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
127.0.0.1 mydomain
127.0.0.1:50 theirdomain
127.0.0.1:51 ourdomain
127.0.0.1:52 yourdomain
It would work fine like that.
EDIT: Actually one more way I thought of. If you associate them all with simply 127.0.0.1, and use the script to send them out appropriatley, it should probably work. _________________ Bienvenidos! |
|
Back to top |
 |
 |
Anonymoose -
Joined: 09 Sep 2003 Posts: 2192
|
Posted: Thu Jul 22, 2004 6:05 am Post subject: |
|
|
You cannot use ports in the hosts file. It is only for mapping names to IP addresses. |
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Thu Jul 22, 2004 8:46 am Post subject: |
|
|
In that case, you're going to have to use the second idea. _________________ Bienvenidos! |
|
Back to top |
 |
 |
gwmbox -
Joined: 21 Jul 2004 Posts: 3
|
Posted: Fri Jul 23, 2004 11:47 am Post subject: |
|
|
Thx for your help - I'll try the second idea and see how I go :)
Cheers
Greg |
|
Back to top |
|
 |
jackofnotrades -
Joined: 23 Mar 2004 Posts: 8
|
Posted: Thu Aug 05, 2004 7:46 am Post subject: Great script |
|
|
This is truly a krad script, bluedog! Thanks a lot! _________________ #8^)> |
|
Back to top |
|
 |
sendit2kevin -
Joined: 05 Jun 2004 Posts: 5
|
Posted: Sat Aug 07, 2004 11:37 pm Post subject: New Releases???? |
|
|
Does anyone know when the new release is coming out? I love Abyss, but am just not a fan of this workaround to host multiple sites.
Aprelium, are you listening? A Virtual Hosting feature would help sooooo much! Thanks for a great product. |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sun Aug 08, 2004 12:04 am Post subject: |
|
|
The next release is due out in September , just hang in their ! |
|
Back to top |
|
 |
trinity -
Joined: 11 Nov 2003 Posts: 20 Location: Tampa, FL
|
Posted: Mon Aug 09, 2004 6:23 am Post subject: |
|
|
I just stumbled across this topic and figured I'd share the script I use for my own site.
It works a little differently than the one posted at the beginning of this thread, in that it doesn't redirect your visitors, but displays a custom index page, depending on the domain being used by the visitor.
I took my script, removed my personal values and added some documentation. It can be downloaded here: http://zionmatrix.com/scripts/
Regards,
Trinity _________________ Please feel free to visit my websites:
BNBT EasyTracker | The Trinity Forums | The Piscean Realm of ZionMatrix |
|
Back to top |
|
 |
HIWD -
Joined: 13 Apr 2004 Posts: 142 Location: Dublin, Ireland
|
Posted: Sat Sep 18, 2004 1:05 pm Post subject: |
|
|
Does anyone know if I can get an ASP version of a script like this? |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
|
Back to top |
|
 |
k1ll3rdr4g0n -
Joined: 04 Jul 2004 Posts: 609
|
Posted: Sun Sep 19, 2004 4:12 am Post subject: |
|
|
I just thought of a new way to handle multiple sites i will work on it later (and no it wont deal with redirections......) _________________
 |
|
Back to top |
|
 |
sendit2kevin -
Joined: 05 Jun 2004 Posts: 5
|
Posted: Sun Sep 19, 2004 4:25 am Post subject: New Release |
|
|
Anyone know when the new release is coming out? I heard it was due in September 2004. Not looking forward to learning how to install and run Apache, but might not have much choice...
Anyone know of another simple web server that allows for running multiple sites? |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sun Sep 19, 2004 10:47 pm Post subject: |
|
|
Im the one that said its due out in september and that was the beta v2 but
the beta Pro probably won't be out untill maybe the beginning of October.
Note: It's very possible that the beta Pro will have Virtual Hosting but
their is no gurantee , you will just have to wait and see what happens :) |
|
Back to top |
|
 |
leokent -
Joined: 15 Apr 2004 Posts: 2 Location: UK
|
Posted: Sun Oct 10, 2004 12:27 pm Post subject: |
|
|
Right I think I'm being thick here but I'm not sure what this script is supposed to do.
Code: | <?
//get domain entered in browser
$HOST = $_SERVER['HTTP_HOST'];
if ($HOST == "forum/127.0.0.1") {
header("Location : /old/index.php");
exit;
}
else {
header("Location : /index.htm");
exit;
}
?> |
So I put that in my index php. Go to 127.0.0.1 it displays index.htm... Good. But if i type in forum/127.0.0.1 it tries to go there rather than reading the script surly??? I am really not sure how I am supposed to use it! |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sun Oct 10, 2004 7:35 pm Post subject: |
|
|
Try the GUI version VHC , its a project that I started a when this script was
invented so that NewB's can use it , You should understand after reading.
Virtual Host Creator
http://vhosting.cjb.net |
|
Back to top |
|
 |
olivierp -
Joined: 23 Apr 2004 Posts: 54 Location: Montreal, Qc
|
Posted: Wed Oct 20, 2004 7:43 pm Post subject: |
|
|
Thanks for your time..
I get this error :
Quote: | Notice: Undefined index: HTTP_REFERER in C:\Program Files\Abyss Web Server\htdocs\index.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Abyss Web Server\htdocs\index.php:3) in C:\Program Files\Abyss Web Server\htdocs\index.php on line 15 |
with this set up :
Quote: | <?
//get domain entered in browser
$HOST = $_SERVER["HTTP_REFERER"];
if ($HOST == "http://streamquest.sytes.net/") {
header("Location : test/index.htm");
exit;
}
if ($HOST == "http://streamquest.sytes.net/") {
header("Location : test/index2.htm");
exit;
}
//... so on
//else show default page
else {
header("Location : error.htm");
exit;
}
?> |
folders
Quote: | index.php is in htdocs
error.htm is htdocs
index.htm is in test |
php
Quote: | Version 4.3.9
php is installed on C:\PHP |
Abyss' index files
Quote: | index.htm
index.html
index.php |
Abyss' CGI parameters
Quote: | CGI Processing Enabled : yes
CGI Error File : log/cgi.log
CGI Scripts' Timeout (seconds) : 30
Resolve interpreter using the Windows Registry : no
Resolve interpreter using the script's #! line : no
CGI interpreters :
interpreter : C:\PHP\php.exe
associated extensions : php
CGI paths :
paths : /*.php
User CGI environment variables :
REDIRECT_STATUS : 200 |
My intenet setup
Quote: | I have a cable connection with a dynamic IP behind a wifi linksys
router, with of course a no-ip.com address and the no-ip software. |
Any suggestions..? |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Wed Oct 20, 2004 9:24 pm Post subject: |
|
|
try this:
<?
//get domain entered in browser
$HOST = $_SERVER["HTTP_REFERER"];
if ($HOST == "streamquest.sytes.net") {
header("Location : test/index.htm");
exit;
}
if ($HOST == "streamquest.sytes.net") {
header("Location : test/index2.htm");
exit;
}
//... so on
//else show default page
else {
header("Location : error.htm");
exit;
}
?> |
|
Back to top |
|
 |
olivierp -
Joined: 23 Apr 2004 Posts: 54 Location: Montreal, Qc
|
Posted: Wed Oct 20, 2004 10:21 pm Post subject: |
|
|
no, it did not work..
I got this error again :
Quote: |
Notice: Undefined index: HTTP_REFERER in C:\Program Files\Abyss Web Server\htdocs\index.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Abyss Web Server\htdocs\index.php:3) in C:\Program Files\Abyss Web Server\htdocs\index.php on line 15
|
I dont believe the problem is related to the .ini file since I did not modify it.
I used the windows installer...
Again, thanks for your help ! |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Thu Oct 21, 2004 1:59 am Post subject: |
|
|
Strange!? I had a similar problem after installing php5 but never on earlier versions. The problem could not be corrected by settings errors in php.ini.
Try This:
Reinstall php and select the advanced installation.
Continue until asked to select the level of error reporting you require.
Select "Display all errors" .
Finish the installation and try the script again. |
|
Back to top |
|
 |
olivierp -
Joined: 23 Apr 2004 Posts: 54 Location: Montreal, Qc
|
Posted: Thu Oct 21, 2004 3:08 am Post subject: |
|
|
I did as youtold me and changed the file names and got my error page
so i guess its a good step forward, however, i cant get the script to work..
Quote: | <?
//get domain entered in browser
$HOST = $_SERVER["HTTP_REFERER"];
if ($HOST == "streamquest.sytes.net") {
header("Location : test/index.htm");
exit;
}
if ($HOST == "streamquest.sytes.net") {
header("Location : test/index.htm");
exit;
}
//... so on
//else show default page
else {
header("Location : error.htm");
exit;
}
?> |
what do you think..
if you want to take a look, http://streamquest.sytes.net |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Thu Oct 21, 2004 3:45 am Post subject: |
|
|
try this:
<?
//get domain entered in browser
$HOST = $_SERVER["HTTP_REFERER"];
if ($HOST == "streamquest.sytes.net") {
header("Location : test/index.htm");
exit;
}
elseif ($HOST == "127.0.0.1") {
header("Location : test/main.htm");
exit;
}
//... so on
//else show default page
else {
header("Location : error.htm");
exit;
}
?> |
|
Back to top |
|
 |
olivierp -
Joined: 23 Apr 2004 Posts: 54 Location: Montreal, Qc
|
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Thu Oct 21, 2004 4:50 am Post subject: |
|
|
i usually don't create test pages for testing because if the page doesn't exist i will be taken to the abyss default 404 page. I don't know why you got redirected to msn, maybe you hit the search button after entering your url. Put some content on index.html main.html and error.html so you can see what page you are being directed to. |
|
Back to top |
|
 |
olivierp -
Joined: 23 Apr 2004 Posts: 54 Location: Montreal, Qc
|
Posted: Fri Oct 22, 2004 12:41 am Post subject: |
|
|
All right..
I got :
index.htm with Winter.jpg
main.htm with a +7 text on it
error.htm with Waterlilies.jpg
index.php
Code: | <?
//get domain entered in browser
$HOST = $_SERVER["HTTP_REFERER"];
if ($HOST == "streamquest.sytes.net") {
header("Location : test/index.htm");
exit;
}
elseif ($HOST == "127.0.0.1") {
header("Location : test/main.htm");
exit;
}
//... so on
//else show default page
else {
header("Location : error.htm");
exit;
}
?> |
I get my error.htm page
Thanks |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Fri Oct 22, 2004 1:11 am Post subject: |
|
|
ok i see the problem for some reason, probably because your not using port 80 the domain streamquest.sytes.net is being served in a frameset. therefore the script will not work.
This will probaly work:
<?
//get domain entered in browser
$HOST = $_SERVER["HTTP_REFERER"];
if ($HOST == "24.203.87.212:6000") {
header("Location : test/index.htm");
exit;
}
elseif ($HOST == "127.0.0.1:6000") {
header("Location : test/main.htm");
exit;
}
//... so on
//else show default page
else {
header("Location : error.htm");
exit;
}
?>
it will not work with streamquest.sytes.net
try these URLs
http://24.203.87.212:6000
http://127.0.0.1:6000
http://localhost:6000 |
|
Back to top |
|
 |
olivierp -
Joined: 23 Apr 2004 Posts: 54 Location: Montreal, Qc
|
Posted: Fri Oct 22, 2004 1:17 am Post subject: |
|
|
I get my error page with all 3 links and the same with my no-ip address
As you said, i am not using port 80 since it is blocked by my provider |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Fri Oct 22, 2004 1:42 am Post subject: |
|
|
ok the script had an error from the begining it shows
$HOST = $_SERVER["HTTP_REFERER"];
should be:
$HOST = $_SERVER["HTTP_HOST"];
$HOST = $_SERVER["HTTP_REFERER"]; was tried in the past by someone with a www.tk frameset with limited success and will not work for all users visiting your site.
Try this:
<?
//get domain entered in browser
$HOST = $_SERVER["HTTP_HOST"];
if ($HOST == "24.203.87.212:6000") {
header("Location : test/index.htm");
exit;
}
elseif ($HOST == "127.0.0.1:6000") {
header("Location : test/main.htm");
exit;
}
//... so on
//else show default page
else {
header("Location : error.htm");
exit;
}
?>
it will not work with streamquest.sytes.net
try these URLs
http://24.203.87.212:6000
http://127.0.0.1:6000
http://localhost:6000 |
|
Back to top |
|
 |
olivierp -
Joined: 23 Apr 2004 Posts: 54 Location: Montreal, Qc
|
Posted: Fri Oct 22, 2004 1:57 am Post subject: |
|
|
thanks, it works, all 3 links brought me to the indicated page...
however, how would I set another no-ip address in this script
say streamquest.sytes.net pointing to test/index.htm
and multiprod.sytes.net pointing to test2/index.htm |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Fri Oct 22, 2004 2:35 am Post subject: |
|
|
I don't know if that is possible If your not using port 80. i will look into it. |
|
Back to top |
|
 |
olivierp -
Joined: 23 Apr 2004 Posts: 54 Location: Montreal, Qc
|
Posted: Fri Oct 22, 2004 2:46 am Post subject: |
|
|
thanks alot, your time is very apreciated |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Fri Oct 22, 2004 11:46 pm Post subject: |
|
|
Since port forwarding is served in a frameset you can not redirect with a script. but you can do it by running another server.
Here is how it can be done:
Go to C:\Program Files and copy "Abyss Web Server". Paste the copy in C:\Program Files. This will make a file named "copy of Abyss Web Server". Rename "copy of Abyss Web Server" to "Abyss Web Server 2". In the "Abyss Web Server 2" folder open the file "abyss.conf".
Change the following three lines:
replace: ServerRoot C:\Program Files\Abyss Web Server\
with: ServerRoot C:\Program Files\Abyss Web Server 2\
replace: Port 6000
with: Port 86 or whatever port you want.
replace: ConsolePort 9999
with: ConsolePort 9099 or whatever port you want.
Save the file. Now you can execute C:\Program Files\Abyss Web Server 2\abyssws.exe
Now you can run a site from C:\Program Files\Abyss Web Server\ and another from C:\Program Files\Abyss Web Server 2\ |
|
Back to top |
|
 |
olivierp -
Joined: 23 Apr 2004 Posts: 54 Location: Montreal, Qc
|
Posted: Sat Oct 23, 2004 4:04 pm Post subject: |
|
|
thanks eznetlinks, that will take care of it for now...
by the way, i understood the prob came from the port fowarding.. But I dont understand the difference between a port and another, I know 80 is the
default setting, but what's different about it ?
So is it the choice of the port or the no-ip address that prevents me from using the script we began with? |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Sat Oct 23, 2004 9:55 pm Post subject: |
|
|
http request are handled on port 80. when someone visits your ip like http://24.203.87.212 they are taken to port 80. Unless given specific instructions not to by adding the port to the URL like http://24.203.87.212:6000. no-ip.com cannot forward to another port it simply cannot be done. So they redirect using a frameset.
Try this example:
Copy and paste the below code to an html page, save it to your server and visit the page.
Code: |
<frameset>
<frame src="http://www.google.com" />
</frameset>
|
you will see the google homepage but the address to your server in the address bar. That is how no-ip redirects to another port. The URL streamquest.sytes.net isn't actually being directed to your server so the script doesn't read streamquest.sytes.net it reads the URL in the frameset which is 24.203.87.212:6000 . That is why the script doesn't work. The script will only work on names directed to your ip with no port . By the way you should use another port other than 6000 because mozilla browsers have the port blocked therefore mozilla users cannot see your site. Here are a list of ports mozilla blocks: http://www.mozilla.org/projects/netlib/PortBanning.html#portlist |
|
Back to top |
|
 |
olivierp -
Joined: 23 Apr 2004 Posts: 54 Location: Montreal, Qc
|
Posted: Sun Oct 24, 2004 4:40 am Post subject: |
|
|
Well thats interesting... Thanks for the info, but why would Mozilla block ports, what good is there for them... |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Sun Oct 24, 2004 3:22 pm Post subject: |
|
|
Mozilla doesn't block the ports, it is using them for services it runs. Only one service can run on each port. Port 110 is used for POP3(Post Office Protocol) So Users can receive mail. The chat client runs off port 531. |
|
Back to top |
|
 |
olivierp -
Joined: 23 Apr 2004 Posts: 54 Location: Montreal, Qc
|
Posted: Tue Oct 26, 2004 1:55 pm Post subject: |
|
|
I see..
So it would not help if I would start no-ip duc as an application rather than a service..? |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Tue Oct 26, 2004 2:45 pm Post subject: |
|
|
No. Doesn't make a difference. Actually if you have a static IP you do not need the DUC, you can use the web interface. |
|
Back to top |
|
 |
Puckey -
Joined: 30 Apr 2003 Posts: 24 Location: Uruguay
|
Posted: Mon Nov 01, 2004 10:58 pm Post subject: Help Please |
|
|
As im not home i've tried this script on a different server...
But I get this error:
Mydomain would actually be: http://www.smartsoftcorp.tk
and my script is:
<?php
//get domain entered in browser
if ($_SERVER['HTTP_HOST'] == "smartsoftcorp.tk") {
//forward to appropriate page
header("Location: /Mainfiles/");
exit;
}
//get domain entered in browser
if ($_SERVER['HTTP_HOST'] == "mail.smartsoftcorp.tk") {
//forward to appropriate page
header("Location: /mail/");
exit;
}
//get domain entered in browser
if ($_SERVER['HTTP_HOST'] == "download.smartsoftcorp.tk") {
//forward to appropriate page
header("Location: /downloads/");
exit;
}
//end duplicating, insert below.
//else show Main Page
else {
header("Location: /index.php");
exit;
}
?>
And my error is:
˙ž<
I've tryed everything and still doesent work
My real server is: http://smartsoftcorp.webcindario.com
And the pathe's are all correct and I dont get it... simply I dont get it... lol... |
|
Back to top |
 |
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Fri Nov 05, 2004 9:07 pm Post subject: |
|
|
The script does not work with frames. |
|
Back to top |
|
 |
xathras -
Joined: 14 Jun 2003 Posts: 2 Location: United Kingdom
|
Posted: Thu Nov 18, 2004 3:07 am Post subject: |
|
|
I had more joy with this script that using apache and virtualhosts
Its simple to use and easier to understand thankyou |
|
Back to top |
|
 |
zoink2000 -
Joined: 29 Jun 2004 Posts: 1
|
Posted: Thu Dec 16, 2004 12:36 am Post subject: |
|
|
i found a bit of a cheat that might help people having problems, its just a slight variation on the same script.
I was having problems getting the dns names from my hosting service, it would always forward to my default IP, regardless of what was typed in before the xxxxx.com, so i changed the line $_SERVER['HTTP_HOST'] with $_SERVER['HTTP_REFERER']
this gets whats in the address bar, rather than what the server passed.
the script i found work is:
<?php
if ($_SERVER['HTTP_REFERER'] == "http://forum.zombrau.com/"){
header(Location: http://www.zombrau.com/forum");
exit;
}
?>
etc. |
|
Back to top |
|
 |
Puckey -
Joined: 30 Apr 2003 Posts: 24 Location: Uruguay
|
Posted: Thu Dec 16, 2004 12:44 am Post subject: |
|
|
I dont get it... what do you mean with frames? |
|
Back to top |
 |
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
|
Back to top |
|
 |
Puckey -
Joined: 30 Apr 2003 Posts: 24 Location: Uruguay
|
Posted: Sun Dec 19, 2004 3:54 am Post subject: |
|
|
Hi, Puckey again...
I tryed out this:
<frameset>
<frame src="smartsoftcorp.webcindario.com/Mainfiles/index.php" />
</frameset>
But still... doesnt work :S |
|
Back to top |
 |
 |
Lung-Dart -
Joined: 24 Feb 2005 Posts: 1
|
Posted: Thu Feb 24, 2005 1:48 am Post subject: |
|
|
Tried installing MySQL according to this tutorial, but when I tried to launch "winmysqladmin.exe" was not in the bin directory, But the installation said it set itself as a service.
So after installing phpmyadmin, or trying to connect to mysql with php i get this error
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\html\php\test.php on line 3
And this is the test.php I used to try it. It's off a php/sql tutorial site for a basic forum
<?php
mysql_connect("localhost", "root", "*******") or die("ERROR in connecting to MySQL:" . mysql_error());
mysql_select_db("forum");
mysql_query("CREATE TABLE topics (id MEDIUMINT NOT NULL AUTO_INCREMENT, subject VARCHAR(60), PRIMARY KEY (id))") or die("ERROR in creating 'topics' table " . mysql_error());
mysql_query("CREATE TABLE posts (id MEDIUMINT NOT NULL AUTO_INCREMENT, topicid MEDIUMINT, author VARCHAR(255), authoremail VARCHAR(255), body BLOB, PRIMARY KEY (id))") or die("ERROR in creating 'posts' table " . mysql_error());
echo "Installation Complete!";
?>
Whats going on here? The password is correct, and even when I try a bad password same error, and with no password, I get a different error saying I need a password
But when I try the password in the Command line, it works. Im at a lost here, any ideas? |
|
Back to top |
|
 |
Skirecs -
Joined: 09 Mar 2005 Posts: 5
|
Posted: Wed Mar 09, 2005 3:21 am Post subject: DYNU port redirection |
|
|
Im using dynu for my dynamic ip, and would like to add more indiviual sites.
my page is skirecs.dynu.com, but before getting redirected to my server, it goes through a port redirection server at DYNU.com. Should I use skirecs.dynu.com or the IP of the Port redirection server for the referrerURL?
Thanks, Skirecs _________________ http://skirecs.dynu.com |
|
Back to top |
|
 |
Ely -
Joined: 05 Apr 2005 Posts: 5 Location: Columbus, Ohio, USA
|
Posted: Tue Apr 05, 2005 9:03 pm Post subject: Running Multiple Domains and Subdomains on an Abyss X1. |
|
|
Introduction
The topic of hosting multiple domains and subdomains on the X1 server has been discussed on this thread quite a bit, but no one has put all the pieces together into a single tutorial. So here's my shot at this. The disclaimer is at the end. :) The work here is based on prior contributions by many and especially bluedog and k1ll3rdr4g0n.
Abstract:
This tutorial shows how to use DynSite, eNom, and an Abyss Web Server X1 with a PHP script for hosting numerous domains and subdomains on a single server. Other dynamic IP resolvers could be used. Their configuration is probably similar to the way DynSite works. Likewise, registrars/DNS services other than eNom could be used. Their functionality is usually very similar. My environment is a Windows XP platform with Abyss X1 V2.0.
Limitations:
All hosted websites share the same server environment. To help with website organization, I opted for a heirarchical directory structure. This requires the use of a relative path for locating images and such. So the <BASE HREF="..."> HTML tag must be used in the <head> section of your web pages. A flat directory structure with all webpages in the /htdocs directory would have probably worked, but then it would have been a naming nightmare. There may be other limitations as well.
Overview
Every domain and subdomain that will be hosted by our X1 points at the same IP. There is no need to use multiple IP's, ports or make it any more complicated. When the DNS sends the http traffic to your X1, the target URL is provided and will be parsed by a script running on X1.
In this example, I'll be working with two domains:
domain1.com
domain2.com
And I will also use several subdomains for each of the above root domains. Here are the steps...
1. The DNS (in my case, eNom)
We start by configuring a DNS for directing http trafic to our X1 server. For eNom this is done using a control panel to set the 'Domain Name Host Records.' We also set up the domain so that a remote program is able to login to our domain and set the appropriate host record.
2. The dynamic IP resolver (in my case DynSite)
Next we configure DynSite to login and set the IP of our target host records. Only one record per each domain needs to be dynamically set.
3. The server directory structure
Next we create a directory structure on the X1 server that reflects the domains and subdomains hosted. (This is not a requirement, just makes it easy to write the script and maintain the websites.)
4. The parsing PHP script
Finally, we install the default script on X1's root which will fetch/redirect http traffic requests as desired.
1. The DNS (in my case, eNom)
Configure the host records as follows:
For domain1.com
@ (none) A (Address) 111.222.123.123 //This is your IP address. It's ok if it's dynamic. Just a starting point.
www Cname (Alias) @ //www is just like the root
* Cname (Alias) @ //Catch-all is just like the root.
Then, set the domain access password for this domain1.com. Remember it. You will need it for the dynamic DNS resolver.
Same thing for domain2.com
@ (none) A (Address) 111.222.123.123 //This is your IP address. It's ok if it's dynamic. Just a starting point.
www Cname (Alias) @ //www is just like the root
* Cname (Alias) @ //Catch-all is just like the root.
Then, set the domain access password for this domain2.com. Remember it. You will need it for the dynamic DNS resolver.
Please note, in the above from the // to the end of the line is just a comment not a setting. By configuring only the root IP and aliasing everyting else to the root makes the setup and the configuration of the dynamic IP resolver easier. Notice that the IP for the above two domains is the same, bucause that's your X1 server's IP.
If you need to host some of the subdomains with another server, you would just configure their record appropriately. For example, you might want to send the catch-all someplace else, so it might look like:
* A (Address) 222.123.123.111
or maybe
* URL Redirect http://allerrors.com/
That's it for the DNS configuration.
2. The dynamic IP resolver (in my case DynSite)
Open the setup dialog box, select the Services tab, expand the 'Dynamic DNS Services' structure and scroll down and select your DNS service. Mine is eNom, Inc.
Click Add and fill out the account form as follows:
Screen Name: domain1.com
Login: domain1.com
check the box, 'This account requires a password'
Password: here fill in the domain access password from the above DNS settings.
Click OK. This creates an account for your DNS service. Next you have to create a host in that account. So select the domain1.com account you just created under eNom (or your DNS service), and click Add. Then fill out the host form (General Tab) as follows:
Screen Name: domain1.com
Host Name:
Domain Name: domain1.com
That's right, the Host Name above is blank. Nothing else needs to be configured so click OK.
OK, that sets up domain1.com for dynamic IP resolution. Now select the DNS service again and Add another account for domain2.com just like for domain1.com. And then select the new domain2.com and add to it the root host domain2.com just like you did for domain1.com.
OK, it's downhill from here.
3. The server directory structure
The script in the next section assumes that all of your domains are hosted from the X1 default /htdocs directory. You must have some default index files set up in your X1 configuration. Mine uses:
index.html
index.htm
index.php
The directory structure I set up is as follows:
/htdocs
/htdocs/domain1.com
/htdocs/domain1.com/www
/htdocs/domain1.com/sub
/htdocs/domain2.com
/htdocs/domain2.com/sub
Notice that in this example, I'll be sending www.domain2.com traffic to domain2.com page, so I did not set up a directory for /htdocs/domain2.com/www. This was done simply for example.
Each one of the directories represents a hosted domain or subdomain. It must have an index file that is the web page for that domain/subdomain.
You are now ready for the meat and potatoes.
4. The parsing PHP script
The /htdocs directory has a special index.php script file that will parse the incoming browser request and fetch the appropriate webpage. In my example, this webpage is an all in one which fetches pages for other domains and subdomains, if they exist. If they don't, an error message is printed. You should not have any other index pages in /htdocs. You want to make sure the index.php page is the one that loads when a browser arrives here. This php script gets some info from the browser about the browser's desired destination, and the script fetches the index page representing the domain or subdomain that was requestd.
Code: | <?php
//My portions of this script are free for all uses, commercial or not. Best success. --Ely
//Start of PHP code to process domain and subdomain names. Note the plural on NAMES!
//get domain entered in browser
$HOST = $_SERVER['HTTP_HOST'];
//Test if this is domain1.com or one of its subdomain.
if (stristr ($HOST, "domain1.com")) { //Use case insensitive 'strstr()' function. Abyss already does a tolower(), but just in case.
//Yes, so switch on the possible domain1.com subdomains.
switch ($HOST) { //In this switch we will process every subdomain and not allow transfer to an error page.
case "domain1.com": //This is the root domain.
//The following 'include()' or 'header()' assume you set up a default index files in the appropriate htdocs subdirectories.
include("http://domain1.com/domain1.com/"); //I like k1ll3rdr4g0n's approach because it doesn't redirect.
//header("Location: /domain1.com/"); //bluedog's re-direct commented out. Works, but I don't like the '302' re-direct.
//Not using 'exit' here because all domains and subs are mapped to a file.
//Exit is at the end of the 'switch' block.
break;
case "www.domain1.com": //The www subdomain.
include("http://domain1.com/domain1.com/www/");
//header("Location: /domain1.com/www/");
break;
case "sub.domain1.com": //Another subdomain. Repeat this structure for all subdomains.
include("http://domain1.com/domain1.com/sub/");
//header("Location: /domain1.com/sub/");
break;
case "misc.domain1.com": //Another subdomain mapped to the 'sub' subdomain.
include("http://domain1.com/domain1.com/sub/");
//header("Location: /domain1.com/sub/");
break;
//All other subdomains of domain1.com get processed here.
default: //Just send them to www
include("http://domain1.com/domain1.com/www/");
//header("Location: /domain1.com/www/");
break;
} //End of switch.
exit; //Need to exit this file here to prevent further processing.
}
// It wasn't the first domain above, so check for the next domain.
if (stristr ($HOST, "domain2.com")) {
//Yes, so switch on the possible domain2.com subdomains.
switch ($HOST) {
case "domain2.com":
include("http://domain2.com/domain2.com/");
//header("Location: /domain2.com/");
exit;
break;
case "www.domain2.com":
include("http://domain2.com/domain2.com/");
//header("Location: /domain2.com/");
exit;
break;
case "sub.domain2.com":
include("http://domain2.com/domain2.com/sub/");
//header("Location: /domain2.com/sub/");
exit;
break;
case "misc.domain2.com":
include("http://domain2.com/domain2.com/www/");
//header("Location: /domain2.com/www/");
exit;
break;
//Unknown subdomain of domain2.com.
default: //This time, let's treat the unknown subdomain as an error.
break;
} //End of switch.
//Default sub of domain2.com does not exit! Just drop out of if{} statement into a web page.
}
//end of host name processing, finally the default page...
//What follows this PHP code is an edited version of Aprelium's default index page.
//End of PHP code.
?>
<HTML>
<HEAD>
<TITLE>Welcome to Abyss Web Server X1</TITLE>
<STYLE type="text/css">
<!--
BODY {
FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: geneva, verdana; BACKGROUND-COLOR: #FFFFFF
}
H1 {
FONT-SIZE: 20px
}
A:hover {
COLOR: #ff9900; TEXT-DECORATION: underline
}
-->
</STYLE>
</HEAD>
<BODY bgColor="#ffffff" text="#000000">
<H1 align=center>Welcome to Abyss Web Server X1</H1>
<BR>
<P>
Welcome to our <B>Abyss Web Server</B>! There is no user website configured at:</p>
<p align=center> <?php echo "$HOST" //Scope of the PHP variable extends here. ?>
</P>
<P>
If you think you've reached this page in error and a user website should be configured here,
please e-mail:</p>
<p align=center>webmaster@yourdomain.com
</p>
<br>
<p>
<center>
<b>This website is hosted on a Sony Vaio with Windows XP and it's <i>'Powered by Abyss Web Server'</i>.</b>
</center>
</P>
<hr>
<P>
<CENTER>
Abyss Web Server X1 -
Copyright © 2001-2005 Aprelium Technologies - All rights reserved
<BR><BR>
<A HREF="http://www.aprelium.com" ><IMG SRC="pwrabyss.png" ALT="Powered by Abyss Web Server" BORDER=0 WIDTH=88 HEIGHT=31></A>
</center></P>
</BODY></HTML> |
Conclusion
This seems to get the job done. When a surfer types a URL of the form: 'http://sub.domain1.com' the appropriate page is fetched and the surfer has the impression she is visiting the domain as entered. But really, with X2 supporting virtual hosts out of the box for less than 60 bucks, it makes me wonder why I put the effort into this. It was a good learning experience, that's for sure. Plus, this can be useful for developers who need to test numerous projects on their personal desktop.
In any case, if anyone finds this useful, that's great. If anyone finds bugs in this tutorial, or suggestions for improvement, please let me know. If this forum let's me edit, I'll come back and fix it. You can post here or e-mail me: ely AT I HAVE ENOUGH SPAM, THANKS 3wheeldrive.com.
Disclaimer
I'm not an expert PHP programmer. In fact I'm not a PHP programmer at all. I've been working on this for the last few days with some difficulty and finally got it to do everything I needed. I thank the ones who posted here before me because I really couldn't have done any of this without their work.
The whole concept of setting the <base > URL makes me queasy and I don't know if it has greater implications and could possibly break some websites. If you know, your comments would be appreciated.
Use this any way you wish and good luck with your websiteS!
[/b] |
|
Back to top |
|
 |
HIWD -
Joined: 13 Apr 2004 Posts: 142 Location: Dublin, Ireland
|
Posted: Wed Apr 06, 2005 1:59 pm Post subject: |
|
|
Buy abyss pro to get this feature. ;)
Regards,
HIWD. |
|
Back to top |
|
 |
Resource -
Joined: 23 Oct 2005 Posts: 2
|
Posted: Sun Oct 23, 2005 12:28 pm Post subject: Spiders |
|
|
How does Google, Yahoo and other search engines handle such redirects?
Search engines or spiders usually ignore or doesn't index sites or files that use frames, redirects and/or cloaking.
OK, they do index them or at least try. Usually you'll end up with one page being indexed and everything else ranked as something else.
But lets get back to my question:
For all that have been using this script, did you notice a drop in visitors and/or search engine rankings, or did it just stay the same? |
|
Back to top |
|
 |
Moxxnixx -
Joined: 21 Jun 2003 Posts: 1226 Location: Florida
|
Posted: Sun Oct 23, 2005 2:48 pm Post subject: |
|
|
Resource, I've never used the script so I don't know what effect it has on Google rankings.
For those interested, Google has a sitemap generator that creates a file to put on your server...
https://www.google.com/webmasters/sitemaps/ |
|
Back to top |
|
 |
|