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
dawg
support
support


Joined: 11 Apr 2004
Posts: 180

PostPosted: Tue Jan 31, 2006 4:30 pm Reply with quoteBack to top

Code:


<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>



Should be:

Code:


<VirtualHost *>
ServerAdmin Admin@yourdomain.com
DocumentRoot C:/apache2triad/www
ServerName www.yourdomain.com
ServerAlias yourdomain.com
DirectoryIndex index.html
ErrorLog c:/apache2triad/logs/www.example.com-error.log
CustomLog c:/apache2triad/logs/www.example-access.log combined
</VirtualHost>

View user's profileSend private message
kuera1
 
 


Joined: 25 Mar 2006
Posts: 1

PostPosted: Sun Mar 26, 2006 2:18 am Reply with quoteBack to top

vhost finally worked out this way:

NameVirtualHost www.example.com:80 --->NOT NameVirtualHost *
<VirtualHost www.example.com:80>
DocumentRoot C:/apache2tria/www
ServerName www.example.com:80
</VirtualHost>

NameVirtualHost www.example.com:443 ---->for SSL
<VirtualHost www.example.com:443>
DocumentRoot C:/apache2tria/www
ServerName www.example.com:443
</VirtualHost>

and add as many as VHOST like above. it's OK to use IP instead of hostname (www.example.com).

NOTE: DO NOT USE NameVirtualHost *
this will declare localhost as a virtualhost, which shouldn't be.
and do not use <VirtualHost localhost> for the same reason. Apache will not function properly with the.

Thanks for author of A2T and forum moderator, i finally got my first site running with all these good stuff. Very Happy
View user's profileSend private message
Joshua Meadows (DemoRic)
support
support


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

PostPosted: Sun Mar 26, 2006 3:41 pm Reply with quoteBack to top

The configuration that you posted will work fine. However, you CAN use
wildcards and include localhost as a virtual host you just need to specify ServerName in each virtual host.

For Example:
Quote:
NameVirtualHost *:80

#localhost
<VirtualHost localhost:80>
ServerAdmin admin@MyHostName.com
DocumentRoot c:/apache2triad/htdocs
ServerName localhost
ErrorLog logs/localhost_error.log
CustomLog logs/localhost_access.log common

##disable mod_security
#SecFilterEngine Off

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

# MyHostName
<VirtualHost *:80>
ServerName MyHostName.com:80
ServerAdmin admin@MyHostName.com
ServerAlias MyHostName.com MyHostNameMirror.com
DocumentRoot "C:/apache2triad/htdocs"

#Remove PHP info in headers
php_value expose_php 0
</VirtualHost>


There are many ways to configure Virtual Hosts however, see: http://httpd.apache.org/docs-2.0/vhosts/
View user's profileSend private messageYahoo MessengerICQ Number
Anim
 
 


Joined: 11 Apr 2006
Posts: 5

PostPosted: Wed Apr 12, 2006 9:24 am Reply with quoteBack to top

Hi Demoric

If I use your sample above then my second virtualhost always displays localhost.

heres my code:

Code:
NameVirtualHost *:80

#localhost
<VirtualHost localhost:80>
  ServerAdmin admin@localhost.com
  DocumentRoot c:/apache2triad/htdocs
  ServerName localhost
  ErrorLog logs/localhost_error.log
  CustomLog logs/localhost_access.log common

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

# dev.softwarediy.com
<VirtualHost *:80>
  ServerName dev.softwarediy.com:80
  ServerAdmin admin@softwarediy.com
  DocumentRoot "C:/apache2triad/htdocs/www/softwarediy.com"

  #Remove PHP info in headers
  php_value expose_php 0
</VirtualHost>


Any Ideas?
Runnning on a local XP Pro dev machine.

Ta
Anim
View user's profileSend private message
SilverDragonRose
 
 


Joined: 17 Apr 2006
Posts: 13
Location: ohio

PostPosted: Mon Apr 17, 2006 5:54 am Reply with quoteBack to top

is this right?

#
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 http:/dragoncreative.no-ip.org>
ServerAdmin silverdragonrs@yahoo.com
DocumentRoot c:/apache2/htdocs/dragoncreative main/
ServerName http:/dragoncreative.no-ip.org
DirectoryIndex index.html
ErrorLog c:/apache2/logs/dragoncreativemain-error.log
CustomLog c:/apache2/logs/dragoncreativemain-access.log combined
</VirtualHost>

<VirtualHost http:/schoolofmagic.no-ip.org>
ServerAdmin silverdragonrs@yahoo.com
DocumentRoot c:/apache2/htdocs/School of Magic/
ServerName http:/schoolofmagic.no-ip.org
DirectoryIndex index.php
ErrorLog c:/apache2/logs/schoolofmagic-error.log
CustomLog c:/apache2/logs/schoolofmagic-access.log combined
</VirtualHost>

<VirtualHost http:/myscience.no-ip.org> <-- dial up sucks)
ServerAdmin silverdragonrs@yahoo.com
DocumentRoot c:/apache2/htdocs/Science/ <-- dir of website on computer)
ServerName http:/science.no-ip.info <---- (using no-ip so server name should be the same as the addy right?)
DirectoryIndex index.php <---- (SMF is in php so is this right? )
ErrorLog c:/apache2/logs/science-error.log
CustomLog c:/apache2/logs/science-access.log combined
</VirtualHost>



I am not sure that I understand all this (computers I am good with. internet.... not so good)

these three sites are all on one machine. one installation of A2T using SMF I would like to add email for my members but that is for another topic.... Does this look correct (i backed up my old file :) just in case )

my biggest problem is three sites... one server... so what should the serber name be? also i dontknow about this listen 80 stuff wheres that go at?

I am waiting to save these changes into the A2T conf directory untill I know its right I really dont want to mess it up (took me long enough just to get it running the first time :)

well thanks for the tutorial and all the other help...

danny
View user's profileSend private messageSend e-mailAIM AddressYahoo MessengerMSN MessengerICQ Number
dawg
support
support


Joined: 11 Apr 2004
Posts: 180

PostPosted: Mon Apr 17, 2006 11:37 am Reply with quoteBack to top

It should look like this:

Code:
<VirtualHost dragoncreative.no-ip.org:80>
ServerAdmin silverdragonrs@yahoo.com
DocumentRoot c:/apache2/htdocs/dragoncreative main/
ServerName dragoncreative.no-ip.org
DirectoryIndex index.html
ErrorLog c:/apache2/logs/dragoncreativemain-error.log
CustomLog c:/apache2/logs/dragoncreativemain-access.log combined
</VirtualHost>


The Listen 80 binds the ip to Port 80 for all incoming connections to your website.
View user's profileSend private message
SilverDragonRose
 
 


Joined: 17 Apr 2006
Posts: 13
Location: ohio

PostPosted: Mon Apr 17, 2006 8:46 pm Reply with quoteBack to top

i havent tested it yet but thank you very much.

is this right for the other then?....

<VirtualHost myscience.no-ip.org:80>
ServerAdmin silverdragonrs@yahoo.com
DocumentRoot c:/apache2/htdocs/dragoncreative main/
ServerName dragoncreative.no-ip.org
DirectoryIndex index.php
ErrorLog c:/apache2/logs/myscience-error.log
CustomLog c:/apache2/logs/myscience-access.log combined
</VirtualHost>

I am assuming that the server name stays the same throughout all the virtualhosts?...

and that i should change directoryindex to index.php since the smf is in php...... right?....

so no matter how many sites i want to host on this server... just add the section above.... and change virtualhostname to the name of the site i created via no-ip.com.... then change the document root to point to the first index.htmp/php for that site.....

i dont really care about the error logs but figure i should have them right anyhow... so they should be changed to mimic the name of the site...

is it right to put all the listening ports to the same port? or should they all have seperate ports? if so how do you know what ones?....

is all this right?.... just want to make sure i understand this part well.....

(dontknow it you know no-ip but the group mane is dragoncreative.... don't know if that matters)

(off topic)
I am stuck with dialup for a little while (broadband isnt available for a while out here) so i am trying to optimise all my settings as much as i can. my sites are not high traffic yet so all is well so far... I need to get as much out of A2T as i can.... is there anything I should turn off?.... on?... to allow all virtualhosted sites to load right/fast?...
View user's profileSend private messageSend e-mailAIM AddressYahoo MessengerMSN MessengerICQ Number
dawg
support
support


Joined: 11 Apr 2004
Posts: 180

PostPosted: Tue Apr 18, 2006 11:28 am Reply with quoteBack to top

the server name should be the same as the Domain name you are using.

To avoid confusion and issues, should things change set the opening Virtual hosts to

<VirtualHost *>


This tells apache to listen on all IP's and All Ports for incoming connections.

Then when the request comes for specific Domains, Apache will process the correct Virtualhost Container based on the Header request.

As for the error logs, I dont use them, but yes, they should be the same format.
View user's profileSend private message
Anim
 
 


Joined: 11 Apr 2006
Posts: 5

PostPosted: Tue Apr 18, 2006 11:33 am Reply with quoteBack to top

dawg

Is this the same for my query posted above too? Maybe I have the * in the wrong place but it was provided as an example that should work, or so I belived.

Cheers
Anim
View user's profileSend private message
dawg
support
support


Joined: 11 Apr 2004
Posts: 180

PostPosted: Tue Apr 18, 2006 4:09 pm Reply with quoteBack to top

Both Places work best -

So NameVirtualhost *

and <VirtualHost *>
View user's profileSend private message
laskosgeorge
 
 


Joined: 09 Jun 2006
Posts: 1

PostPosted: Fri Jun 09, 2006 9:24 pm Reply with quoteBack to top

hello my name is george.
I am trying 2 months now to make no-ip domain name that i have to work with apache but nothing.

i have try all suggestions but apache cant "Listen"
i have a domain name d2sales.no-ip.org
i have setup my router to port forwarding.
eg my machines ip is: 192.168.1.20
and i have do port forwarding tcp/udp this ip to listen on port 80.
No firewall and routers firewall is off.

i use DUC client to my pc.
with older version before 3-4 months apache worked.

need port forwarding other ports? i have port forwarding: 80, 110, 21 to listen to my pc ip.

i have setup virtual hosts like this:

<VirtualHost *>
ServerAdmin webmasters@d2sales.no-ip.org
DocumentRoot C:/apache2triad/htdocs/nuke
ServerName d2sales.no-ip.org
DirectoryIndex index.php
ErrorLog logs/localhosten.com-error_log
CustomLog logs/localhosten common
</VirtualHost>

Plz i need some help i have a 3com 11g Router.

is there any possibility to block my isp port 80?

" no-ip duc client works fine with d2sales.no-ip.org coz i have install
a remote software (ultravnc) and at the point that software requires ip
address to connect i give the static name... "

if the problem is to my apache conf file twll me if you know where and what i must change.

What i must do?

With best Regards.
View user's profileSend private message
Anim
 
 


Joined: 11 Apr 2006
Posts: 5

PostPosted: Sat Jun 10, 2006 7:21 am Reply with quoteBack to top

Make sure that ports are being forwarded correctly

goto www.grc.com and click "Shields Up"
Scroll down to "Hot Spots" and click "Shields Up"

Here you can scan your common ports to see which are open (like 80)

Anim
View user's profileSend private message
felipe
 
 


Joined: 19 Jul 2006
Posts: 4

PostPosted: Wed Jul 19, 2006 4:00 am Reply with quoteBack to top

I have apache 2.2.2 win32 binaries that I downloaded quite recently. I attempted to search in google and in these forums for an answer to my question. It appears that, either I cannot search well Laughing - or my question is too obscure (the former seems plausible, the latter, not)

Question:
How do I make it so that when people visit http;//domain.tld they are automatically & permanently redirected to http;//www.domain.tld?

I have tried the following - as well as a few modifications - but nothing has worked so far. (substituting domain.tld with my REAL domain name)

Code:
Redirect permanent http://domain.tld http://www.domain.tld


Last edited by felipe on Wed Jul 19, 2006 7:28 pm; edited 1 time in total
View user's profileSend private message
dawg
support
support


Joined: 11 Apr 2004
Posts: 180

PostPosted: Wed Jul 19, 2006 11:42 am Reply with quoteBack to top

Why not CNAME www.domain.tld to domain.tld --

But here is the answer:

http://httpd.apache.org/docs/2.2/mod/mod_alias.html

Redirect permanent /one http://example.com/two
Redirect 303 /three http://example.com/other

along with http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
View user's profileSend private message
felipe
 
 


Joined: 19 Jul 2006
Posts: 4

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

it's all about mod_rewrite.

Now! off to learn about regex! Crying or Very sad
View user's profileSend private message
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