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
kolatracks
past contributor
past contributor


Joined: 07 Jul 2003
Posts: 313
Location: UK

PostPosted: Fri Jul 11, 2003 10:06 am Reply with quoteBack to top

Step 1:
Open c:\apache2\conf\httpd.conf and find:
Code:
#NameVirtualHost *
DirectoryIndex index.html index.html.var index.php index.php4 index.shtml index.cgi
AddType text/plain .cnf
AddType text/plain .conf
AddType text/plain .ini
AddType text/plain .log


change
Code:
#NameVirtualHost *

to
Code:
NameVirtualHost *


Step 2:
Replace
Code:
#<VirtualHost *>


with
Code:
<VirtualHost YOURIP>
    ServerAdmin webmaster@yourdomain.com
    DocumentRoot c:/apache2/htdocs/yourdomain
    ServerName www.yourdomain.com
    ServerAlias yourdomain.com
    DirectoryIndex index.html
    ErrorLog c:/apache2/logs/www.yourdomain.com-error.log
    CustomLog c:/apache2/logs/www.yourdomain.com-access.log combined
</VirtualHost>

#Fill in "yourdomain" with your details.
Replace 'YOURIP' with the ip for the virtual host. Must not be 127.0.0.1 otherwise phpmyadmin, awstats, apache2triad CP will not work.

For multiple virtual hosts insert the above code again below the last one.


Last edited by kolatracks on Fri Jul 11, 2003 11:08 pm; edited 1 time in total
View user's profileSend private message
ken
 
 


Joined: 09 Jul 2003
Posts: 10

PostPosted: Fri Jul 11, 2003 8:18 pm Reply with quoteBack to top

Hi, I've enjoyed the tutorials and they are great....
However after setting up the virtual hosts I cannot acces the apache2triad.html anymore even as localhost it takes me right to the first virtual host addres I've set up. How should I acces phpmyadmin and how can I acces awstats for the virtual hosts??

TIA

Great Job you all
Respect

Ken
View user's profileSend private message
kolatracks
past contributor
past contributor


Joined: 07 Jul 2003
Posts: 313
Location: UK

PostPosted: Fri Jul 11, 2003 10:00 pm Reply with quoteBack to top

The problem is that now apache2triad is set for virtual hosts on all IP's.
Find the virtual host section you just added and find
Code:
<VirtualHost *>
    ServerAdmin webmaster@yourdomain.com
    DocumentRoot c:/apache2/htdocs/yourdomain
    ServerName www.yourdomain.com
    ServerAlias yourdomain.com
    DirectoryIndex index.html
    ErrorLog c:/apache2/logs/www.yourdomain.com-error.log
    CustomLog c:/apache2/logs/www.yourdomain.com-access.log combined
</VirtualHost>

Change the * to your IP, anytyhing except 127.0.0.1. Now the virtual host is only running on the IP you just gave it. And phpmyadmin, awstats and apache2triad.html is now accessable from localhost(127.0.0.1) only. Let me know know if this works. I have a similar setup and it runs fine. If it still doesn't work post the lines in your "httpd.conf". Try and not incude the lines that start With '#'.
Also if you plan to use this tutorial so you can host your own website. Let me know if you want a tutorial About how to secure your website. For instance you might to password protect awstats or protect it so awstats can only be seen on the network or local computer.
View user's profileSend private message
ken
 
 


Joined: 09 Jul 2003
Posts: 10

PostPosted: Sat Jul 12, 2003 11:00 am Reply with quoteBack to top

I would love a tutorial about securing website... TIA

Worked fine but cant acces awstats anymore for the local site
View user's profileSend private message
mandrake
 
 


Joined: 27 Jul 2003
Posts: 1
Location: NL

PostPosted: Sun Jul 27, 2003 9:16 am Reply with quoteBack to top

I did not change the * to a ip adres and all is working fine.
I use many virtual domains.
All is working on my system.

I use a: amd 1.5 gHZ
512 Mb
Windows Xp cooperate SP1



BTW. This is a good tuturial
View user's profileSend private message
zork
 
 


Joined: 14 Jul 2003
Posts: 13
Location: uk

PostPosted: Sun Jul 27, 2003 10:00 pm Reply with quoteBack to top

What happens if your connection is dynamic. Like the ip address changes everytime you connect to the net.

as it is i use no_ip.com for my dynamic addy, this way i can have a static domain name. Using the free program that comes NO-IP when i connect itupdates the ip address before anything else.

On this note im assuming that the virtual host name will be the no-ip addy.
________
volcano classic vaporizer


Last edited by zork on Mon Jan 31, 2011 11:23 pm; edited 1 time in total
View user's profileSend private message
kolatracks
past contributor
past contributor


Joined: 07 Jul 2003
Posts: 313
Location: UK

PostPosted: Mon Jul 28, 2003 12:26 am Reply with quoteBack to top

Yes. Anywhere I said to put your IP, put your domain name instead.
View user's profileSend private message
kristofor
 
 


Joined: 20 Nov 2003
Posts: 9
Location: Australia

PostPosted: Fri Nov 21, 2003 5:37 am Reply with quoteBack to top

is this what i use to make my ip address site available for people to see, or do i have to do something else
View user's profileSend private messageMSN Messenger
kolatracks
past contributor
past contributor


Joined: 07 Jul 2003
Posts: 313
Location: UK

PostPosted: Fri Nov 21, 2003 4:59 pm Reply with quoteBack to top

No. Virtual hosts are used when hosting multiple domains. If you only have one domain or ip then you don't to need vhosts.
View user's profileSend private message
kristofor
 
 


Joined: 20 Nov 2003
Posts: 9
Location: Australia

PostPosted: Sat Nov 22, 2003 7:29 am Reply with quoteBack to top

ahh ok, then what do i do so that someone else can view my site on the net, do i have to change any settings
View user's profileSend private messageMSN Messenger
thehellwitu
 
 


Joined: 15 Nov 2003
Posts: 33
Location: Florida

PostPosted: Sat Nov 22, 2003 1:36 pm Reply with quoteBack to top

to host a domain do i also have to setup name servers and stuff like if i want to host some elses domain?
View user's profileSend private messageSend e-mailAIM AddressYahoo MessengerMSN Messenger
K9Trooper
 
 


Joined: 20 Feb 2004
Posts: 5

PostPosted: Fri Feb 20, 2004 3:47 pm Reply with quoteBack to top

I have 1 IP and 4 web sites on my server. I have been using IIS for years and now want to try Apache. I use no-ip's DUC (Dynamic Update Client) to keep my IP up to date.

From what I can tell so far from the tutorial is that
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 k9ftp.myftp.org (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.
View user's profileSend private message
kolatracks
past contributor
past contributor


Joined: 07 Jul 2003
Posts: 313
Location: UK

PostPosted: Fri Feb 20, 2004 11:54 pm Reply with quoteBack to top

A few corrections,
DocumentRoot c:/apache2/htdocs/yourdomain <---- the directory from which documents are served.

ServerAlias yourdomain.com <---- You don't need this. This is generally used if you have a you have 'www.domain.tld' and 'domain.tld' and want to serve them under the same vhost.

ErrorLog c:/apache2/logs/www.yourdomain.com-error.log <---- Leaving this in will cause apache to log all errors from this domain under a seperate logfile.

CustomLog c:/apache2/logs/www.yourdomain.com-access.log combined <---- As above but logs transfers instead of errors.

With regard to the logging, if you don't specify the above directives then apache will still log things, but inside the same logfile as the main server instead of seperatly.

Quote:
Now how do I add the other sites?

Just add multiple <VirtualHost> directives. Just don't repeat the 'NameVirtualHost' directive.

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

Make each DocumentRoot directive different.

Sorry for the late reply but today's been a strange day.
View user's profileSend private message
K9Trooper
 
 


Joined: 20 Feb 2004
Posts: 5

PostPosted: Sat Feb 21, 2004 2:33 am Reply with quoteBack to top

Thanks :)

I am going to get on it right now.

**EDIT**

Thank you. You have been very helpful. It works.
Now to tackle SQL and php :? LOL
View user's profileSend private message
GoVeGeTa
 
 


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

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

hi guys, i am having a similar problem with the httpd.conf settings.
My Problem;
I am running apache2triad 1.2 on xp2500, win xp pro behind a broadband router, with static i.p and a No-IP.com domain name (gtdesign.no-ip.com).

My problem is that I cant get apache to serve what i want it to.
From inside my network when i type in the domain name http://gtdesign.no-ip.com I get the login screen for my broadband modem.
And i tested this today from outside my network, and all i could see was the document_root under apache2.
I tried to configure httpd.conf with what was posted in here, but apache would not restart. Saying the service could not restart.
Any help with this would be greatly appreciated.
I ended up having to coment out the changes i made in the <VirtualHosts>
directive.
Thanks in advance
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