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
Joshua Meadows (DemoRic)
support
support


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

PostPosted: Wed Jul 19, 2006 10:45 pm Reply with quoteBack to top

not to change the topic, but since you're using mod_rewrite a great cheat sheet is at http://www.ilovejackdaniels.com/apache/mod_rewrite-cheat-sheet/
(I use it quite frequently)
View user's profileSend private messageYahoo MessengerICQ Number
felipe
 
 


Joined: 19 Jul 2006
Posts: 4

PostPosted: Thu Jul 20, 2006 2:18 am Reply with quoteBack to top

OMG! that site has it all. thanks so much! from now on ilovejackdaniels.
View user's profileSend private message
entropik
 
 


Joined: 25 Aug 2006
Posts: 2

PostPosted: Fri Aug 25, 2006 8:54 pm Reply with quoteBack to top

NameVirtualHost apathetik.dnsalias.com:80
#NameVirtualHost *
#NameVirtualHost 74.135.37.41:80

<VirtualHost 192.168.1.200>
ServerName www.metal-xchange.com
ServerAdmin entropiknemisiz@yahoo.com
DocumentRoot K:\apache2triad\htdocs\metal-xchange
ErrorLog logs/metal-xchange-error_log
CustomLog logs/metal-xchange-access_log common
</VirtualHost>

#<VirtualHost *>
# ServerAdmin entropiknemisiz@yahoo.com
# DocumentRoot K:\apache2triad\htdocs\plaguemail
# ServerName www.plaguemail.com
# ErrorLog logs/plaguemail-error_log
# CustomLog logs/plaguemail-access_log common
#</VirtualHost>


httpd -S displays:
[warn] NameVirtualHost apathetik.dnsalias.com:80 has no virtual hosts
VirtualHost Config:
192.168.1.200:* www.metal-xchange.com (k:\apache2triad\conf\httpd.conf:1049)
syntax okay


This is my description of what happens and what my problem is.

I have two domains I wish to run from my PC. Under the current configuration [above] one domain works. When I enable the second virtualhost for the second domain, the results is:

1) apache2triadCP link [http://localhost/apache2triadCP/] links to an "oops" page.
2) domain www.metal-xchange.com and www.plaguemail.com both display htdocs folder contents.
3) http://localhost/ displays the index.htm for www.plaguemail.com

I have tried:
A) assigning each virtual host by domain vs. IP.
B) assigning both by IP (using same IP, which is 192.168.1.200, i do not know if I can set up two IP's on Windows XP, never had a need, but would probably be a fix)
C) assigning one by URL and one by IP
D) All astrixes
E) NameVHost *, with all above combinations
F) assigning one Vhost as * and other at IP
G) assigning one Vhost as * and other at URL

This is a clean install, the only changes in the httpd.conf has been the above lines, so if I need to change something ELSE from default, it has not been done.

Again, my OS is winXP.

EDIT: for anyone wondering apathetik.dnsalias.com is a DDNS alias for my router, which is the IP two lines below at the time of using it. I used it to make sure the DDNS worked, which it does.

ANOTHER EDIT: using unique IP's did not work.

YET ANOTHER TEEN EDIT: Unique ports does work, but I do not want to use different ports, unless someone can explain to me how I can automatically route www.plaguemail.com to port 81 without using the :81 at the end (so site users do not have to input www.plaguemail.com:81 to access the site)

Current config:
NameVirtualHost apathetik.dnsalias.com:*

<VirtualHost 192.168.1.200:80>
ServerName www.metal-xchange.com
ServerAdmin admin@metal-xchange.com
DocumentRoot K:\apache2triad\htdocs\metal-xchange
ErrorLog logs/metal-xchange-error_log
CustomLog logs/metal-xchange-access_log common
</VirtualHost>

<VirtualHost 192.168.1.200:81>
ServerAdmin admin@plaguemail.com
DocumentRoot K:\apache2triad\htdocs\plaguemail
ServerName www.plaguemail.com
ErrorLog logs/plaguemail-error_log
CustomLog logs/plaguemail-access_log common
</VirtualHost>

httpd -S output:
[warn] NameVirtualHost apathetik.dnsalias.com:* has no virtual hosts <this "warn" seems it may be the root of the problem, perhaps?>
192.168.1.200:80 www.metal-xchange.com (k:/apache2triad/conf/httpd.conf:1042)

192.168.1.200.81 www.plaguemail.com
(k:/apache2triad/conf/httpd.conf:1050)

syntax ok
View user's profileSend private message
eddiek156
 
 


Joined: 31 Aug 2006
Posts: 1

PostPosted: Thu Aug 31, 2006 12:07 pm Reply with quoteBack to top

Please help. Very new to apache. It is kinda working, but not quite.

When I go to http://127.0.0.1 or http://joomla or http://cyberhome using IE6 from the server itself I get the pages I would expect. When I go to another machine on the network http://127.0.0.1 works fine, http://joomla works fine, but http://cyberhome takes me to the same page as http://127.0.0.1 (ie the root of htdocs).

when I alter the line (in the cyberhome section):-

<VirtualHost localhost>

to

<VirtualHost 10.220.4.109>

then both http://cyberhome and http://joomal take me to the cyberhome pages.

I want to host a few different sites on this server eventually. Where am I going wrong.



*******************************************************
NameVirtualHost localhost

<VirtualHost localhost>
ServerName localhost
DocumentRoot "C:/apache2triad/htdocs"
php_value include_path "C:/apache2triad/htdocs"
</VirtualHost>

<VirtualHost localhost>
ServerName cyberhome
DocumentRoot "C:/apache2triad/htdocs/cyberhome"
php_value include_path "C:/apache2triad/htdocs/cyberhome"
</VirtualHost>

<VirtualHost 10.220.4.109>
ServerName joomla
DocumentRoot "C:/apache2triad/htdocs/joomla"
php_value include_path "C:/apache2triad/htdocs/joomla
</VirtualHost>
****************************************************

Regards
Ed
View user's profileSend private message
Joshua Meadows (DemoRic)
support
support


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

PostPosted: Sun Sep 03, 2006 2:02 am Reply with quoteBack to top

try changing <VirtualHost 10.220.4.109>
to
Quote:
<VirtualHost _default_:80>

for the site you want all unknown traffic to resolve to.

also try using your full servername, and any aliases.
example from my config:
Quote:
ServerName jaydium.servehttp.com:80
ServerAdmin admin@jaydium.servehttp.com
ServerAlias jaydium.selfhost.com jaydium.servehttp.com


Lastly, make certain that you have the following defined somewhere in your config.

Quote:
NameVirtualHost *:80

When I first started doing virtual hosts I about went crazy trying to figure out why my other sites wouldn't resolve properly until I found out that little mistake.
View user's profileSend private messageYahoo MessengerICQ Number
Drum
 
 


Joined: 25 Nov 2006
Posts: 1

PostPosted: Sat Nov 25, 2006 4:46 am Reply with quoteBack to top

I have been using Server 2003 IIS with DynDNS updater for my IP address.
Now I install Apache2Triad and follow the instructions in the manual and on this forum.
Then from my workstation I try go to my website and it says "Connecting...." and then says Time-Outed
How do I set Apache2Triad to work with my DYNDNS updater and so the web can see my website with other domains I am hosting.

Thanks
Cheers
View user's profileSend private messageSend e-mail
mutha88
 
 


Joined: 01 Jan 2007
Posts: 4

PostPosted: Mon Jan 01, 2007 9:50 pm Reply with quoteBack to top

Quote:

Code:
<VirtualHost YOURIP> <----- would this be my IP behind the router or my external IP
    ServerAdmin webmaster@yourdomain.com <---- My email
    DocumentRoot c:/apache2/htdocs/yourdomain <---- what exactly is this?
    ServerName www.yourdomain.com <---- would be mutha.bol.bg (no www since it is http://k9ftp.myftp.org)
    ServerAlias yourdomain.com <---- no-ip.com or www.no-ip.com???
    DirectoryIndex index.html
    ErrorLog c:/apache2/logs/www.yourdomain.com-error.log <---- if I leave this like that apache's error logs will be enabled?
    CustomLog c:/apache2/logs/www.yourdomain.com-access.log combined
</VirtualHost>


Now how do I add the other sites?

How exactly do I get this to point to each of my sites folders?

Sorry for all this I am extremly new to apache.


That's y question.Have a happy new year and please answer me ! Sad
View user's profileSend private message
lku homer
 
 


Joined: 29 May 2006
Posts: 104

PostPosted: Tue Jan 02, 2007 4:22 am Reply with quoteBack to top

Sorry to throw you to another topic, but I answered that question here:
http://apache2triad.net/forums/viewtopic.php?t=5032
View user's profileSend private messageAIM AddressYahoo MessengerMSN MessengerICQ Number
Joshua Meadows (DemoRic)
support
support


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

PostPosted: Tue Jan 02, 2007 11:39 pm Reply with quoteBack to top

Quote:
<VirtualHost YOURIP> <----- would this be my IP behind the router or my external IP
ServerAdmin webmaster@yourdomain.com <---- My email
DocumentRoot c:/apache2/htdocs/yourdomain <---- what exactly is this?
ServerName www.yourdomain.com <---- would be mutha.bol.bg (no www since it is http://k9ftp.myftp.org)
ServerAlias yourdomain.com <---- no-ip.com or www.no-ip.com???
DirectoryIndex index.html
ErrorLog c:/apache2/logs/www.yourdomain.com-error.log <---- if I leave this like that apache's error logs will be enabled?
CustomLog c:/apache2/logs/www.yourdomain.com-access.log combined
</VirtualHost>


YOURIP is what you want the virtual host to answer on. Personally I just use a * wildcard to say all ip addresses.

DocumentRoot is the first folder that site is bound on (the root folder). Think of it as your webistes' C:\ drive.

ServerName is just that your websites name (mysite.com for example)
ServerAlias is other names the site goes by. (www.mysite.com ww2.mysite.com)
ErrorLog is the config for the filename that the virtual host you are editing will use. I suggest you replace yourdomain with your actual domain, but you don't have to.
View user's profileSend private messageYahoo MessengerICQ Number
mutha88
 
 


Joined: 01 Jan 2007
Posts: 4

PostPosted: Wed Jan 03, 2007 1:17 pm Reply with quoteBack to top

My site is hosted on my ip.Under Servername should i post it ? Or under alias ? And if I don't have any alias, what should i type ? Should I delete the whole Serveralias row ? Rolling Eyes

I'm sorry for these questions, but i'm noob Embarassed Embarassed Embarassed

EDIT:

I have another problem too (question).How could i make and edit my apache to show not the htdocs directory in my http wbe server, but another directory ? Just for example.No it is showing the C:\apache2triad\htdocs, when i type my ip in the browser.I want to show another directory, for example D:\flash get\SOFTWARE.How can i do that ? Do I need to make a virtual host ?
Embarassed Embarassed Embarassed
View user's profileSend private message
lku homer
 
 


Joined: 29 May 2006
Posts: 104

PostPosted: Wed Jan 03, 2007 3:44 pm Reply with quoteBack to top

You can have it host to your IP, instead of a domain name. If you have a name I would suggest using the name.

Code:

ServerName YOURIP


If you have a domain name, as well as the IP, I would recomend this:
Code:

ServerName www.domain.com
ServerAlias YOURIP


And as for making the webserver so something other then c:\apache2triad\htdocs, in your httpd.conf find:
Code:

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:\apache2triad\htdocs"

and replace the DocumentRoot with:
Code:

DocumentRoot "D:\flash get\SOFTWARE"


This is all assuming that you have only one site listed. If you want to have it set for VitualHosts, I can show you that too, just post back here and I can help you with that.

**EDIT**
By trying it myself, I don't think that changing the DocumentRoot is a good thing >.> So I would make a VHost:

Code:

<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot c:/apache2triad/htdocs
ErrorLog logs/error.log
CustomLog logs/access.log common
</VirtualHost>

<VirtualHost *:80>
ServerName YOURIP
DocumentRoot D:\flash get\SOFTWARE
ErrorLog logs/domain-error.log
CustomLog logs/domain-access.log common
</virtualHost>


That should work.
View user's profileSend private messageAIM AddressYahoo MessengerMSN MessengerICQ Number
mutha88
 
 


Joined: 01 Jan 2007
Posts: 4

PostPosted: Wed Jan 03, 2007 8:57 pm Reply with quoteBack to top

When I change the DocumentRoot it gives me that error:

Quote:
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.


And by the way . . . thank you for the help . . . Smile Embarassed Rolling Eyes
View user's profileSend private message
lku homer
 
 


Joined: 29 May 2006
Posts: 104

PostPosted: Wed Jan 03, 2007 9:29 pm Reply with quoteBack to top

Are you doing the DocumentRoot in the main config or the Vhost section?

Like I said, doing it in the main config is bad. You need to add vhosts.
View user's profileSend private messageAIM AddressYahoo MessengerMSN MessengerICQ Number
mutha88
 
 


Joined: 01 Jan 2007
Posts: 4

PostPosted: Thu Jan 04, 2007 11:35 am Reply with quoteBack to top

lku homer wrote:
Are you doing the DocumentRoot in the main config or the Vhost section?

Like I said, doing it in the main config is bad. You need to add vhosts.



Aha.Ok.I will ad host then i will write here, if i experience some problems Rolling Eyes Embarassed


EDIT:

This is my result after the edit.NOTHING CHANGED ! ! !
Code:

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "D:\flash get\SOFTWARE"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
#<Directory "D:\flash get\SOFTWARE">






And the virtual host:

Code:

#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 *:80>
#ServerName MYIPISHERE
#DocumentRoot D:/flash get/SOFTWARE
#ErrorLog logs/MYDOMAINISHERE-error.log
#CustomLog logs/MYDOMAINISHERE--access.log common
#</virtualHost>


Where have I mistaken ? ? ? Embarassed Sad
View user's profileSend private message
lku homer
 
 


Joined: 29 May 2006
Posts: 104

PostPosted: Thu Jan 04, 2007 4:14 pm Reply with quoteBack to top

mutha88 wrote:
lku homer wrote:
Are you doing the DocumentRoot in the main config or the Vhost section?

Like I said, doing it in the main config is bad. You need to add vhosts.



Aha.Ok.I will ad host then i will write here, if i experience some problems Rolling Eyes Embarassed


EDIT:
Code:

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "D:\flash get\SOFTWARE"


#
# This should be changed to whatever you set DocumentRoot to.
#
#<Directory "D:\flash get\SOFTWARE">


Change that back to :
Code:

DocumentRoot "C:\apache2triad\htdocs"


As for the VHost you want it to look like this:
Code:

<VirtualHost localhost:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot C:/apache2triad/htdocs
ErrorLog logs/error.log
CustomLog logs/access.log common

#display php errors
php_value register_globals 0
php_value error_reporting 2047
php_value display_errors 1
</VirtualHost>

<VirtualHost YOURIP:80>
ServerName YOURIP
ServerAdmin webmaster@YOURIP
DocumentRoot D:/flash get/SOFTWARE
ErrorLog logs/SITENAME-error.log
CustomLog logs/SITENAME-access.log common
</VirtualHost>


I am not sure whether or not you have to, but I know adding the localhost works. So make sure that is in there as well.

Code:

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

Because your not using name based hosting, I would assume that you wouldn't have that line uncommented, so double-check that.

In the Global Environment you may want to do this:
Code:

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen YOURIP:80


Thats all I can really think of.
View user's profileSend private messageAIM AddressYahoo MessengerMSN MessengerICQ Number
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