Apache2Triad Help, Support and Development Forum Index Apache2Triad Help, Support and Development
The apache2triad help , support and development forums
 

Tutorial: How to setup virtual hosts in Apache2Triad
Click here to go to the original topic
Goto page 1, 2, 3, 4, 5, 6  Next
 
       Apache2Triad Help, Support and Development Forum Index -> Apache
View previous topic :: View next topic  
Author Message
kolatracks



Joined: 07 Jul 2003
Posts: 313
Location: UK

Posted: Fri Jul 11, 2003 10:06 am    Post subject: Tutorial: How to setup virtual hosts in Apache2Triad  

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.
Back to top  
ken



Joined: 09 Jul 2003
Posts: 10

Posted: Fri Jul 11, 2003 8:18 pm    Post subject: how to reach apache2triad.html??  

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
Back to top  
kolatracks



Joined: 07 Jul 2003
Posts: 313
Location: UK

Posted: Fri Jul 11, 2003 10:00 pm    Post subject: reply  

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.
Back to top  
ken



Joined: 09 Jul 2003
Posts: 10

Posted: Sat Jul 12, 2003 11:00 am    Post subject: Re: reply  

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

Worked fine but cant acces awstats anymore for the local site
Back to top  
mandrake



Joined: 27 Jul 2003
Posts: 1
Location: NL

Posted: Sun Jul 27, 2003 9:16 am    Post subject:  

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
Back to top  
zork



Joined: 14 Jul 2003
Posts: 13
Location: uk

Posted: Sun Jul 27, 2003 10:00 pm    Post subject:  

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
Back to top  
kolatracks



Joined: 07 Jul 2003
Posts: 313
Location: UK

Posted: Mon Jul 28, 2003 12:26 am    Post subject:  

Yes. Anywhere I said to put your IP, put your domain name instead.
Back to top  
kristofor



Joined: 20 Nov 2003
Posts: 9
Location: Australia

Posted: Fri Nov 21, 2003 5:37 am    Post subject:  

is this what i use to make my ip address site available for people to see, or do i have to do something else
Back to top  
kolatracks



Joined: 07 Jul 2003
Posts: 313
Location: UK

Posted: Fri Nov 21, 2003 4:59 pm    Post subject:  

No. Virtual hosts are used when hosting multiple domains. If you only have one domain or ip then you don't to need vhosts.
Back to top  
kristofor



Joined: 20 Nov 2003
Posts: 9
Location: Australia

Posted: Sat Nov 22, 2003 7:29 am    Post subject:  

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
Back to top  
thehellwitu



Joined: 15 Nov 2003
Posts: 33
Location: Florida

Posted: Sat Nov 22, 2003 1:36 pm    Post subject:  

to host a domain do i also have to setup name servers and stuff like if i want to host some elses domain?
Back to top  
K9Trooper



Joined: 20 Feb 2004
Posts: 5

Posted: Fri Feb 20, 2004 3:47 pm    Post subject:  

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.
Back to top  
kolatracks



Joined: 07 Jul 2003
Posts: 313
Location: UK

Posted: Fri Feb 20, 2004 11:54 pm    Post subject:  

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.
Back to top  
K9Trooper



Joined: 20 Feb 2004
Posts: 5

Posted: Sat Feb 21, 2004 2:33 am    Post subject:  

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
Back to top  
GoVeGeTa



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

Posted: Thu Apr 01, 2004 2:24 pm    Post subject:  

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
Back to top  
 
       Apache2Triad Help, Support and Development Forum Index -> Apache Goto page 1, 2, 3, 4, 5, 6  Next
Page 1 of 6


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.13 © 2001, 2002 phpBB Group