multiple server

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
andyshen
-


Joined: 08 Dec 2003
Posts: 36

PostPosted: Sat Jan 10, 2004 8:44 am    Post subject: multiple server Reply with quote

is there ways to create different servers for example

www.spartanpacific.com
www.yourname.com
www.georgebush.com

all linking to your server with different directories?
Back to top View user's profile Send private message
jtc970
-


Joined: 24 Mar 2003
Posts: 172

PostPosted: Sat Jan 10, 2004 10:39 am    Post subject: Reply with quote

if you have perl running you can use this script

just have abyss point to this first as the index.pl

Code:
#!/usr/bin/perl -w

use strict;
#use CGI::Carp qw/ fatalsToBrowser /;


################################################################
#                                                              #
#                   DomainDirector v2.2                        #
#               http://www.scriptsolutions.com/                #
#                     All rights reserved                      #
#                                                              #
# Domain Director is copyright 1998-2003, Creative             #
# Fundamentals, Inc.  It is distributed under the same         #
# terms as Perl itself.  See the "Artistic License" at         #
# http://www.opensource.org/licenses/artistic-license.html for #
# licensing terms.                                             #
#                                                              #
################################################################


################################################################
# Enter the main page of your primary website

my $mainpage       = 'index.html';


################################################################
# If your server has wildcards enabled, then enter 1 below.
# Otherwise, enter 0 (that's a zero, not a capital o)

my $wildcards = 0;


################################################################
# To make redirection more transaparent, you can choose to use
# lwp, which will fetch the page and display it without
# causing a change in the browser address bar.  If you have lwp
# installed on your server and want to use transparent
# redirection, enter 1  if you don't, enter 0
# When using lwp, be sure that your target pages use absolute
# urls for your images and links. eg:
# <IMG SRC="http://www.domain.com/images/image.gif"> instead of
# <IMG SRC="image.gif">

my $use_lwp = 0;


################################################################
# Enter domain names below that you do not want to be
# redirected via wildcards.  By default, wildcarded domains
# will use http://wildcarddomain.domain.com/wildcarddomain/, so
# if something needs to be redirected differently, define the
# domain and the page it needs to be redirected to here.
# Note that if you have 4th level domains
#(eg my.fourth.level.domain.com) or higher, each level will be
# its own subdirectory in reverse.  eg:
# http://my.fourth.level.domain.com/level/fourth/my/

# To redirect to an off-server web page, use the fully qualified url,
# such as http://offsite.com/page.html

# To redirect to a page on the server this program is installed, simply
# enter the path to the file starting from the domain name.

my %domains = (

    'www.spartanpacific.com' => '/spartan/index.htm',   
    'www.yourname.com' => 'http://wherever.com',
   

);



################################################################
#               DO NOT CHANGE BELOW THIS LINE!                 #
################################################################

my ( $match, $server )  = ( 0, undef );

( $server = lc( $ENV{'HTTP_HOST'} ) ) =~ s/^www\.//;

$server = "www.$server" if ($server =~ tr/\.// == 1);

for my $domain( keys %domains ){

    if ( lc $domain eq $server ){
        $match = 1;

        if ($domains{$server} =~ m|http://|){
            fetch_page( $domains{$server} );
        }
        else {
            fetch_page( "http://$server/$domains{$server}" );
        }
    }
}

unless ( $match == 1 ){

    my $url = "http://$server/$mainpage";

    if ( $wildcards && $server !~ /^www\./ && $server !~ /^(\d{1,3}\.){3}\d{1,3}$/ ){
        my @domain = split( /\./, $server );
        splice ( @domain, -2 ); # throw away first and second levels of domain
        my $dir = join( '/', reverse @domain ) ;
        $url = "http://$server/$dir/";
    }

    fetch_page( $url );

}


sub fetch_page {

    my $url = shift;

    eval { require LWP::UserAgent };

    if ( $@ || !$use_lwp ){
        print "Location: $url\n\n";
        return;
    }
    else {
        my $webagent = new LWP::UserAgent;
        my $response = $webagent->request( new HTTP::Request( GET => $url ) );

        if ( $response->is_success ) {
            print "Content-type:  text/html\n\n", $response->content, "\n";
            return;
        }
    }

    print "Location: $url \n\n";
    return;
}


Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Sat Jan 10, 2004 7:24 pm    Post subject: Reply with quote

http://multiple-sites.tk
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group