Apache2Triad Help, Support and Development Forum Index Search Profile Log in to check your private messages Log in Register Memberlist Attachments Statistics Crew/Ranks Archive
 Tutorial: How to setup virtual hosts in Apache2Triad
Google
Post new topic Reply to topic
Author Message
GoVeGeTa
 
 


Joined: 01 Apr 2004
Posts: 2
Location: Perth, Oz

PostPosted: Thu Apr 01, 2004 2:46 pm Reply with quoteBack to top

here is a snippet of code from my httpd.conf file



NameVirtualHost 202.72.168.192

<VirtualHost 202.72.168.192>
ServerAdmin hamusydney@westnet.com.au
DocumentRoot c:/apache2/htdocs/phpnuke
ServerName www.gtdesign.no-ip.com
ServerAlias gtdesign.no-ip.com
DirectoryIndex index.html index.htm index.php default.htm
ErrorLog c:/apache2/logs/www.gtdesign.no-ip.com-error.log
CustomLog c:/apache2/logs/www.gtdesign.no-ip.com.log combined
</VirtualHost>

As you can see i only want to serve phpnuke from this domain name.
But all i see from my network is the login screen to my broadband modem.
View user's profileSend private message
ivari
 
 


Joined: 14 Apr 2004
Posts: 2

PostPosted: Wed Apr 14, 2004 4:33 am Reply with quoteBack to top

I want to make virtual host, but i does'nt have domain yet, I want my virtual host work with Netbios name service like

http://webone/
http://webtwo/
etc

I need help please Question
View user's profileSend private message
clapp
 
 


Joined: 20 Apr 2004
Posts: 2

PostPosted: Mon Jun 14, 2004 8:33 pm Reply with quoteBack to top

ok i followed your instructions and i'm able to view the different websites but Php is being displayed as text.. do i have a setting wrong?
View user's profileSend private message
Ranbir
 
 


Joined: 16 Jul 2004
Posts: 3

PostPosted: Fri Jul 23, 2004 12:30 am Reply with quoteBack to top

I ran into the problem of testing / debugging and designing more than one website at a time (which is no fun if you are on dialup).

so, here is the solution. It works for me perfectly, html, php, mysql work like a charm.

step 1: make some 'listen' entries:
Listen 127.0.0.1:80
Listen 127.0.0.1:81
Listen 127.0.0.1:82
Listen 127.0.0.1:83

(so apache knows which ports on which IP you want to use)
(it's safer too)
step 2: enter the virtual host configuration:

<VirtualHost localhost:81>
DocumentRoot C:/apache2triad/htdocs/yoursite1/httpfolder/
ErrorLog logs/virtual1-error_log
CustomLog logs/virtual1-access_log common
</VirtualHost>
<VirtualHost localhost:82>
DocumentRoot C:/apache2triad/htdocs/yoursite2/httpfolder/
ErrorLog logs/virtual2-error_log
CustomLog logs/virtual2-access_log common
</VirtualHost>
<VirtualHost localhost:83>
DocumentRoot C:/apache2triad/htdocs/yoursite3/httpfolder/
ErrorLog logs/virtual3-error_log
CustomLog logs/virtual3-access_log common
</VirtualHost>

of course you can define the DocumentRoot just anywhere. Z:/nobody/knows/me/
Smile

next thing you need is just type http://127.0.0.1:81 in your browser to use a perfectly new local website with all bells'n'whistles

You could make some 'mini html' to test the paths:

<html>
<head>
<title>vh1 test</title>
</head>
<body>
<center>
<h3>VirtualHost localhost:81 works perfectly</h3>
</center>
</body>
</html>

Thanks for your attention, I'd beg mancini to put this link into the FAQ as well, I guess there is a lot of confusion.

All material of this little tutorial was adapted from warious gooooogle powered websearches and http://www.galatea.com/flashguides/virtual-hosting.xml

cheers!

Ranbir

http://www.gurmatps.org
View user's profileSend private message
ransom
 
 


Joined: 12 Aug 2004
Posts: 1

PostPosted: Thu Aug 12, 2004 5:13 am Reply with quoteBack to top

Sounds like yer modem is a router aswell.

99% of the time the IP address for sutch devices is 192.168.0.1 some times 2 and in other cases somthing completely difrent.

log onto that IP and make shure it's forwarding your trafic (ususaly called "port forwarding" though not alwas)

You'll need to know the user/pass probibly aswell.

PS: aneyone else with those devices that see this should do so NOW. If you start hooking a name server to your IP and are viewing it from "localhost" you leave your self open for someone loging into your realitivly un-protected firewall.

Best case senerio they disable your ability to use it so you HAVE to reset it. Worst they put in VPN or other stuff in the router letting them hop in and out, even after you've changed the pass and it stays that way for years or till ya notice somthing REALY wrong.
View user's profileSend private message
poppaducci
 
 


Joined: 08 Mar 2005
Posts: 3

PostPosted: Tue Mar 08, 2005 6:48 pm Reply with quoteBack to top

#Here is a different look at how to configure virtual hosting...........without #using the asterisk.....
#
#************************************************************

##############################################
#AS IT STATES.NAME BASED VIRTUAL HOSTING not (*)
##############################################
# Use name-based virtual hosting.
#
NameVirtualHost pcis.net:80
NameVirtualHost www.pcis.net:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost pcis.net:80>
ServerAdmin pcis@comcast.net
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/pcis"
ServerName pcis.net
ErrorLog logs/web-error_log
CustomLog logs/pcis.net-access_log common
</VirtualHost>

<VirtualHost pcis.net:80>
ServerAdmin pcis@comcast.net
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/pcis"
ServerName www.pcis.net
ErrorLog logs/web-error_log
CustomLog logs/pcis.net-access_log common
</VirtualHost>

##############################################
#That is all there is to it... Use your subdomain addy if thats the only url #that you have to use. Such as a no-ip domain. Like a zapto.org domain #or whatever.......Just make sure that the document root points to the #folder that you set aside for that specific domain. That specific domain #will only reach files in the folder you specify as the doc root. You can #also use the serverroot php functions in your scripts and it sees your #virtual hosting domain folder as if it were the main htdocs directory of #apache.
##############################################
View user's profileSend private message
Judgegeo
 
 


Joined: 19 Apr 2005
Posts: 1

PostPosted: Tue Apr 19, 2005 10:26 pm Reply with quoteBack to top

I was wondering if i could use a DNS instead of my IP when filling in virtual host.

Thanks.
View user's profileSend private message
webmastertgp
 
 


Joined: 10 Apr 2005
Posts: 3
Location: Guatemala

PostPosted: Sun Jun 12, 2005 3:22 am Reply with quoteBack to top

I already did all of the tutorial but it dosen't work... I create 1 virtual host called virtualhost2 and the main virtual host as localhost but if i try to access to the virtualhost2 it show the tipical error page... if I put this virtualhost firs then showme the content of the localhost... Crying or Very sad

In fact I change the file host in windows because i read it may be the reason...


this is the code I add to the http.conf


#localhost
<VirtualHost *:80>
ServerAdmin admin@localhost
DocumentRoot "D:/masdetodos"
ServerName localhost
ErrorLog logs/localhost.com-error_log
CustomLog logs/localhost.com-access_log common
</VirtualHost>


#localhost2
<VirtualHost *:80>
ServerAdmin admin@localhost2
DocumentRoot "D:/masdetodos/promomensajes"
ServerName localhost2
ErrorLog logs/localhost2-error_log
CustomLog logs/localhost2-access_log common
</VirtualHost>


Thanks for your help
View user's profileSend private messageMSN Messenger
LoKo
 
 


Joined: 23 Jun 2005
Posts: 1

PostPosted: Thu Jun 23, 2005 6:45 am Reply with quoteBack to top

OK Well I have a static IP and my ISP is RCN...but besides that... Here's a look at my httpd.conf file...Tell me what I'm doing wrong PLZ.


Code:

#
# Use name-based virtual hosting.
#
NameVirtualHost *

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost 209.6.101.4>
ServerAdmin webmaster@lokohosting.net
DocumentRoot E:\Apache2Triad\htdocs\~loko
ServerName www.lokohosting.net
ServerAlias lokohosting.net
DirectoryIndex index.html
ErrorLog c:/apache2/logs/www.lokohosting.net-error.log
CustomLog c:/apache2/logs/www.lokohosting.net-access.log
combined
</VirtualHost>

<VirtualHost 209.6.101.4>
ServerAdmin webmaster@waushare.com
DocumentRoot E:\Apache2Triad\htdocs\~wau
ServerName www.waushare.com
ServerAlias waushare.com
DirectoryIndex index.html
ErrorLog c:/apache2/logs/www.waushare.com-error.log
CustomLog c:/apache2/logs/www.waushare.com-access.log
combined
</VirtualHost>
#
## Apache2Triad config starts here


Do I want the IP to be the one of my Internal IP or my external? I'm behind a router also, with my server as my DMZ Host.
View user's profileSend private messageAIM Address
jduval
 
 


Joined: 01 Jul 2005
Posts: 13

PostPosted: Fri Jul 01, 2005 5:47 am Reply with quoteBack to top

hello

i have two computers and i have installed apache2triad on one of them and is running great.

how do i redirect a request on a virtual host from server 1 to server 2??? like server accepts the request from internet then pass it to server 2 to server the request

thanks!!!!! Shocked Shocked Shocked
View user's profileSend private message
Magnanakaw
 
 


Joined: 10 Aug 2005
Posts: 3

PostPosted: Wed Aug 17, 2005 3:22 pm Reply with quoteBack to top

i tried that script but it didnt works...
also when i stop my apache, i cant start it anymore...
View user's profileSend private message
Joshua Meadows (DemoRic)
support
support


Joined: 29 Dec 2004
Posts: 783
Location: S.E. Kansas

PostPosted: Wed Aug 17, 2005 11:33 pm Reply with quoteBack to top

It sounds like you have an error in your syntax.

Open a command window and type:
Quote:
apache -t


That'll tell you roughly where the mis-configuration in your httpd.conf file is.
View user's profileSend private messageYahoo MessengerICQ Number
Magnanakaw
 
 


Joined: 10 Aug 2005
Posts: 3

PostPosted: Fri Aug 19, 2005 4:46 am Reply with quoteBack to top

tnx for the help man... i managed to start my apache again... Smile
View user's profileSend private message
nlstart
 
 


Joined: 10 Jan 2006
Posts: 2
Location: NL

PostPosted: Tue Jan 10, 2006 7:09 pm Reply with quoteBack to top

I had the following problem with the httpd.conf settings for virtual hosts under Apache 2.0.54 (Apache2Triad version 1.5.3), with a Windows XP SP2 behind a broadband router, with static IP and a EuroDNS domain name (directing to this static IP address).

My problem was that I couldn't get Apache to end up in the specific directory; when I surfed to my website locally it worked fine. When I surfed to the domain name from an outside IP address I ended up in my Apache2Trias localhost directory. Initially, I could not figure out what was wrong. I found the clue by studying and applying the notes in:
http://apache2triad.net/forums/viewtopic.php?t=800&start=0&postdays=0&postorder=asc&highlight=virtual+host+localhost

The httpd summary that is working for me:
Code:
Listen 80

ServerAdmin admin@localhost

ServerName localhost:80

DocumentRoot "C:/apache2triad/htdocs"

NameVirtualHost *

# localhost
<VirtualHost *>
ServerName localhost
ServerAdmin webmaster@myowndomain.nl
DocumentRoot c:/apache2triad/htdocs
ErrorLog logs/localhost_error.log
CustomLog logs/localhost_access.log common
</VirtualHost>

# myowndomain.nl
<VirtualHost *>
ServerName www.myowndomain.nl
ServerAdmin webmaster@myowndomain.nl
DocumentRoot c:/apache2triad/htdocs/myowndomain.nl
ServerAlias myowndomain.nl
ErrorLog logs/myowndomain.nl-error_log.log
TransferLog logs/myowndomain.nl-access_log.log
</VirtualHost>
View user's profileSend private message
Gintar
 
 


Joined: 31 Jan 2006
Posts: 2

PostPosted: Tue Jan 31, 2006 3:19 pm Reply with quoteBack to top

This is exactly how my config is (domains changed)
Im trying to run 2 domains.

When I try to restart apachetriad I get the error Operation failed......

Does anyone see something wrong?

Any help is greatly apreciated!

I tried changing * to ip #s and domain names same result btw
___________________________________________________
NameVirtualHost *
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#

<VirtualHost *>
ServerAdmin Admin@datesomeone.net
DocumentRoot C:/apache2tria/www
ServerName www.example.com
ServerAlias yourdomain.com
DirectoryIndex index.html
ErrorLog c:/apache2reiad/logs/www.example.com-error.log
CustomLog c:/apache2triad/logs/www.example-access.log combined
</VirtualHost>
View user's profileSend private messageMSN Messenger
Display posts from previous:      
Post new topic Reply to topic


 Jump to:   



View next topic
View previous topic
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
You cannot attach files in this forum
You cannot download files in this forum
Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme
All times are GMT