Jump to content

Cre8asiteforums Internet Marketing
and Conversion Web Design


Photo

Host multiple sites on one server with Apache


  • Please log in to reply
36 replies to this topic

#1 Andy

Andy

    Mach 1 Member

  • Members
  • 492 posts

Posted 30 January 2003 - 06:44 AM

Thought i'd share this with you.

I have my own webserver on a 1 Megabit line, at the moment I have 2 websites, and use Apache 2.

Manuals seem to make things complicated os here's a siomple guide on how to do it.

First of all you'll need to edit the httpd.conf file, this can be found in your Apache directory, and then in the conf subdirectory, sor example this is where mine is:
C:apacheconfhttpd.conf

The file is well commented, anything that has a # before it is a comment, so you can comment lines out you don't need or add comments to help you.

The area of the file we will be looking at, is usually at the very bottom of the file, Section 3: Virtual Hosts.

#

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

#    ServerAdmin webmaster@dummy-host.example.com

#    DocumentRoot /www/docs/dummy-host.example.com

#    ServerName dummy-host.example.com

#    ErrorLog logs/dummy-host.example.com-error_log

#    CustomLog logs/dummy-host.example.com-access_log common

#</VirtualHost>


The above is the sample VirtualHost out of the httpd.conf file, the entire thing is commented out, as from this server VirtualHosts are not been used.

For each site you want to setup you have to create a VirtualHost, the first virtual host is the default, e.g if i do, http://80.194.49.33 that is not specifying a website, so the default one is displayed, which in my case is www.whittnet.co.uk.

Something i have noticed is, you have to create two, entries for one site, one for http://www.coolchip-computers.co.uk/ and one for http://coolchip-computers.co.uk.

This is because if you don't have an entry for the one without the www, it will show the default site, as it has no record of just coolchip-computers.co.uk.

For every VirtualHost you need to put the information within a Virtaul host tag, <VirtualHost *> options goes here </VirtualHost>.

The most common options are:
ServerAdmin,DocumentRoot,ServerName.
ServerAdmin #AdminsEmailAddress

DocumentRoot #DocumentRoot e.g c:apachehtdocsdomain1

ServerName #servers FullyQualifiedDomainName e.g www.whittnet.co.uk
Example:

<VirtualHost *>

    ServerAdmin andy@somewhere.com

    DocumentRoot e:htdocswhittnet

    ServerName www.whittnet.co.uk

</VirtualHost>

Int the above notice i did, www. So i'd have to create another without the www, example:
<VirtualHost *>

    ServerAdmin andy@somewhere.com

    DocumentRoot e:htdocswhittnet

    ServerName whittnet.co.uk

</VirtualHost>

To add another VirtualHost just follow the above.

Once you have edited the file you have to restart the Apache service, this can be done by using the apache control panel or by the services MMC snapin in your administrative tools.

The below example shows my VirtualHost setup:
<VirtualHost *>

    ServerAdmin andy@somewhere.com

    DocumentRoot e:htdocswhittnet

    ServerName whittnet.co.uk

</VirtualHost>



<VirtualHost *>

    ServerAdmin andy@somewhere.com

    DocumentRoot e:htdocswhittnet

    ServerName www.whittnet.co.uk

</VirtualHost>



<VirtualHost *>

    ServerAdmin andy@somewhere.com

    DocumentRoot e:htdocscoolchip-computers

    ServerName www.coolchip-computers.co.uk

    #RewriteEngine On

    #RewriteRule ^forum/(.*).html(.*)/$ /forum.php?forumID=$1

</VirtualHost>



<VirtualHost *>

    ServerAdmin andy@somewhere.com

    DocumentRoot e:htdocscoolchip-computers

    ServerName coolchip-computers.co.uk

    #RewriteEngine On

    #RewriteRule ^forum/(.*).html(.*)/$ /forum.php?forumID=$1

</VirtualHost>

note in the above example the rewrite rules, rewrite rules can be applied to avirtual host, at the moment, i'm having some probs with mine so there commented out.

Hope this has been helpful.


Extra Documentation:
[list]

#2 themover

themover

    New To Community

  • Members
  • 1 posts

Posted 30 March 2003 - 11:52 AM

Im having problems with apache virtual hosting. Apache will only host the site that is listed in the main server configuration of DocumentRoot. If I change the DocumentRoot folder to the second sites folder then that site will come up. Its as if the virtual hosts section is not working at all. Also, the NameVirtualHost line is uncommented, both sites have FQDN, and DNS is properly configured. Helppppppppppp!

#3 DianeV

DianeV

    Honored One Who Served Moderator Alumni

  • Hall Of Fame
  • 7216 posts

Posted 30 March 2003 - 12:06 PM

Okay, I'm no pro at this, but I found this in my httpd.conf file:


# The NameVirtualHost directive is a required directive

# if you want to configure name-based virtual hosts.



NameVirtualHost 111.222.333.444:*



# VirtualHost: Allows the daemon to respond to requests for

# more than one hostname.

Then, of course, as Andy has so helpfully pointed out, you must have the VirtualHost entries, but it sounds like you already do.

And welcome to the forums!

#4 njgMike99

njgMike99

    Ready To Fly Member

  • Members
  • 23 posts

Posted 08 April 2003 - 11:41 AM

Hi,

I am also having the same problem with multiple domains. U am using Linux Mandrake 9.1, Apache 2.0.44 and BIND 9

I know my DNS works for the subdomain db.okboss.com address at my domain www.okboss.com cause I did test at sam spade. And it reports my ip address ok.

My problem is that I added the virtual host below and my web server keeps sending me to the default page instead. I have check my logs and I can't seem to find any reference to the problem. Please help. Should I have a _default_ server configured if using virtual domains?

Here is my Vhosts.conf
NameVirtualHost 66.11.174.82

<VirtualHost 66.11.174.82>

       ServerName www.okboss.com

       ServerAlias okboss.com *.okboss.com

       DocumentRoot /var/www/html

</VirtualHost>

<VirtualHost 66.11.174.82>

    DocumentRoot /var/www/html/php/phpmyadmin

    ServerName db.okboss.com

    ErrorLog logs/db.okboss.com-error_log

    CustomLog logs/db.okboss.com-access_log common

</VirtualHost>

I have tried to use NameVirtualHost * but I still get the same results. Has anyone seen this before?

Mike :P [/code][/url]

#5 Andy

Andy

    Mach 1 Member

  • Members
  • 492 posts

Posted 08 April 2003 - 11:48 AM

Just a thought but put your subdomain before your domain one in your conf file, maybe it goes on some kind of priority.

So it comes in and cos your coming in on that domain thats why it goes to your other site.

NameVirtualHost 66.11.174.82 

 

<VirtualHost 66.11.174.82> 

    DocumentRoot /var/www/html/php/phpmyadmin 

    ServerName db.okboss.com 

    ErrorLog logs/db.okboss.com-error_log 

    CustomLog logs/db.okboss.com-access_log common 

</VirtualHost>

<VirtualHost 66.11.174.82> 

       ServerName www.okboss.com 

       ServerAlias okboss.com *.okboss.com 

       DocumentRoot /var/www/html 

</VirtualHost>

worth a stab, but i could be making sh*t up.

:D

#6 njgMike99

njgMike99

    Ready To Fly Member

  • Members
  • 23 posts

Posted 08 April 2003 - 01:01 PM

That did it!!! :D :D :D

I reversed the order for the virtual servers and it did the trick!!! I have been work ing on that for 2 days now! :?


NameVirtualHost 66.11.174.82

<VirtualHost 66.11.174.82>

       ServerName webmail.okboss.com

       #ServerAlias okboss.com *.okboss.com

       DocumentRoot /var/www/html/squirrel

</VirtualHost>

<VirtualHost 66.11.174.82>

#ServerAdmin webmaster@dummy-host.example.com

    DocumentRoot /var/www/html/db

    ServerName db.okboss.com

    ErrorLog logs/db.okboss.com-error_log

    CustomLog logs/db.okboss.com-access_log common

</VirtualHost>

<VirtualHost 66.11.174.82>

       ServerName www.okboss.com

       ServerAlias okboss.com *.okboss.com

       DocumentRoot /var/www/html

</VirtualHost>


Thank you very very very much! Now all I have to do is create a virtual host for a different domain altogether. Yikes.. I hope its the same process. I'll Let you all know how I did. :)

Thanks again Andy, all the way from Canada![/code]

#7 Andy

Andy

    Mach 1 Member

  • Members
  • 492 posts

Posted 08 April 2003 - 03:44 PM

Your welcome dude, yeh keep us posted!

:D

#8 Viper

Viper

    Unlurked Energy

  • Members
  • 3 posts

Posted 27 April 2003 - 02:31 AM

Just found this, and wanted to say thx for some good information!

I do have one question/problem tough...

When I setup a second domain I get some sort of a MySql problem with one of my forums.

I have these 2 sites that Im working on: http://ranger.servegame.com and http://df-news.com/

http://ranger.servegame.com works well.

http://df-news.com/ only works like this...

If I have it like this http://www.df-news.com/ I get problems. Why does the www give me problems? Can it be fixed?

#9 Black_Knight

Black_Knight

    Honored One Who Served Moderator Alumni

  • Hall Of Fame
  • 9339 posts

Posted 27 April 2003 - 02:40 AM

If I have it like this http://www.df-news.com/  I get problems. Why does the www give me problems? Can it be fixed?


Make sure you've specified the www subdomain in your setup
      ServerName www.df-news.com

       ServerAlias df-news.com *.df-news.com



#10 Viper

Viper

    Unlurked Energy

  • Members
  • 3 posts

Posted 27 April 2003 - 02:52 AM

Wow that was fast thx, this is how I have my config. Thanks for looking at it...

NameVirtualHost www.df-news.com





<VirtualHost www.df-news.com>

    ServerAdmin admin@df-news.com

    DocumentRoot C:EasyServwww

    ServerName www.df-news.com

    ErrorLog logs/dummy-host.example.com-error_log

    CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>



<VirtualHost ranger.servegame.com>

    ServerAdmin viper@rtfbase.com

    DocumentRoot C:ranger

    ServerName ranger.servegame.com

    ErrorLog logs/dummy-host.example.com-error_log

    CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>









#11 Viper

Viper

    Unlurked Energy

  • Members
  • 3 posts

Posted 27 April 2003 - 03:09 AM

Think I need additional information on how to solve it... :cry:

Dont know how to use your snipe of code you posted (I have tried).

#12 njgMike99

njgMike99

    Ready To Fly Member

  • Members
  • 23 posts

Posted 28 April 2003 - 06:40 AM

Ok.. Now Im trying to use SSL on one of my sites but when I put the SSL directives into the virtual hosts the whole site changes to SSL instead of the individual virtual hosts.


# ----------------------- WEBMAIL OKBOSS ------------------

<VirtualHost 66.11.174.82>

       ServerName webmail.okboss.com

       #ServerAlias okboss.com *.okboss.com

       DocumentRoot /var/www/html/squirrel

       ErrorLog syslog

       LogLevel info

      #SSLEngine on

      #SSLProtocol +SSLv2 +SSLv3

      #SSLCertificateFile /etc/ssl/apache/server.crt

      #SSLCertificateKeyFile /etc/ssl/apache/server.key

</VirtualHost>



# ----------------------- OKBOSS.COM ------------------

<VirtualHost 66.11.174.82>

       ServerName www.okboss.com

       ServerAlias okboss.com *.okboss.com

       LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i""

       TransferLog /var/log/httpd/access_log

       DocumentRoot /var/www/html

SSLEngine off

</VirtualHost>


Any ideas why this might be happening?

#13 njgMike99

njgMike99

    Ready To Fly Member

  • Members
  • 23 posts

Posted 30 April 2003 - 11:47 AM

I figured it out! Although I didn't find any clear documentations on it I managed to make it work like so...

Apache 2.0.45
How to create SSL Virtual Hosts and NON-SSL virtual host on one server.

Vhosts.conf - Or possibly Httpd2.conf

NameVirtualHost 66.11.174.82:443

NameVirtualHost 66.11.174.82:80



# ----------------------- WEBMAIL OKBOSS SSL------------------

<VirtualHost 66.11.174.82:443>

       ServerName webmail.okboss.com

       DocumentRoot /var/www/html/squirrel

       SSLEngine on

       SSLCertificateFile /etc/ssl/apache/server.crt

       SSLCertificateKeyFile /etc/ssl/apache/server.key

</VirtualHost>

# ----------------------- DB OKBOSS ------------------

<VirtualHost 66.11.174.82:80>

    DocumentRoot /var/www/html/database

    ServerName db.okboss.com

    ErrorLog logs/db.okboss.com-error_log

    CustomLog logs/db.okboss.com-access_log common

</VirtualHost>



# ----------------------- SURPRISEMYWIFE.COM ------------------

<VirtualHost 66.11.174.82:80>

       ServerName surprisemywife.com

       ServerAlias surprisemywife.com *.surprisemywife.com

       DocumentRoot /var/www/html/surprisemywife

	LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i""

	TransferLog /var/log/httpd/surprisemywife_access_log

</VirtualHost>



# ----------------------- SURPRISEMYWIFE.CA ------------------

<VirtualHost 66.11.174.82:80>

       ServerName surprisemywife.ca

       ServerAlias surprisemywife.ca *.surprisemywife.ca

       DocumentRoot /var/www/html/surprisemywife

       LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i""

       TransferLog /var/log/httpd/surprisemywife_access_log

</VirtualHost>



# ----------------------- OKBOSS.COM ------------------

<VirtualHost 66.11.174.82:80>

       ServerName www.okboss.com

       ServerAlias okboss.com *.okboss.com

       LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i""

       TransferLog /var/log/httpd/access_log

       DocumentRoot /var/www/html

</VirtualHost>



# ----------------------- OKBOSS.COM SSL ------------------

<VirtualHost 66.11.174.82:443>

       ServerName www.okboss.com

       ServerAlias okboss.com *.okboss.com

       LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i""

       TransferLog /var/log/httpd/access_log

       DocumentRoot /var/www/html

       SSLEngine on

       SSLProtocol +SSLv2 +SSLv3

       SSLCertificateFile /etc/ssl/apache/server.crt

       SSLCertificateKeyFile /etc/ssl/apache/server.key

</VirtualHost>


Hope this helps anyone other there.. 8)

[/b]

#14 DianeV

DianeV

    Honored One Who Served Moderator Alumni

  • Hall Of Fame
  • 7216 posts

Posted 30 April 2003 - 03:52 PM

I'm sure it will. Thanks for the information!

#15 beno

beno

    Unlurked Energy

  • Members
  • 3 posts

Posted 31 August 2003 - 02:15 PM

This tutorial has been a really helpful tool in getting apache configured to host several virtual sites on a single IP. I have a buddy who is trying to host 4 sites on a single IP, and currently has 4 sites being forwarded to that address (209.50.25.178) over a static DSL connection, acting server is running Windows 200 Pro.

After reading this, I now have 2 of the sites working, the main site (www.stunttours.com), and the first virtual site listed in my httpd.conf file (www.comedynetworkonline.com). The other virtual sites appear to all be going to the first virtual site I have listed. Anyone have any clues as to why this might be happening? Here is my code:


NameVirtualHost 209.50.25.178: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 209.50.25.178>

    ServerAdmin dbaier@stunttours.com

    DocumentRoot "E:/comedy"

    ServerName www.comedynetworkonline.com

    serverAlias *.comedynetworkonline.com

    ErrorLog logs/comedy_error_log

#   CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>



<VirtualHost 209.50.25.178>

    ServerAdmin dbaier@stunttours.com

    DocumentRoot "E:/concert"

    ServerName www.concertservicenetwork.com

    ServerAlias *.concertservicenetwork.com

    ErrorLog logs/concert_error_log

#   CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>



<VirtualHost 209.50.25.178>

    ServerAdmin dbaier@stunttours.com

    DocumentRoot "E:/celebrity"

    ServerName www.celebrityattractionsnetwork.com

    ErrorLog logs/celebrity_error_log

#   CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>



<VirtualHost 209.50.25.178>

    ServerAdmin dbaier@stunttours.com

    DocumentRoot "E:/stunt"

    ServerName www.stunttours.com

    ErrorLog logs/stunt_error_log

#   CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>


I have been searching on the net for hours for some sort of tutorial or post that might explain what I don't have set up right, but haven't been able to find anything yet. Thanks in advance for any advice you might have, it is truly appreciated

#16 DianeV

DianeV

    Honored One Who Served Moderator Alumni

  • Hall Of Fame
  • 7216 posts

Posted 31 August 2003 - 07:57 PM

This is set up a little differently than my own httpd.conf, but I note that your first two examples include a ServerAlias, and the others don't. Have you tried specifying ServerAlias for the rest?

#17 beno

beno

    Unlurked Energy

  • Members
  • 3 posts

Posted 31 August 2003 - 10:28 PM

I'm heading over to his place in a little bit here, I'll give that a shot (specifying aliases for the other 2 servers), I didn't know whether or not the server alias definitions were necessary so I'll give that a try! Thanks a million for the input.

#18 beno

beno

    Unlurked Energy

  • Members
  • 3 posts

Posted 03 September 2003 - 07:30 PM

well, I updated all sections so they all contain the alias, but I can still only get those first 2 sites to come up. Any other suggestions? Thanks for your help.

#19 pvclink

pvclink

    Ready To Fly Member

  • Members
  • 10 posts

Posted 03 October 2003 - 05:10 AM

Hello,


Hi its me again

sure i known there's a lot of people would help me thanks a lot in addvance

problem

I could not display my new documentRoot on my new vertual domains?

#20 BillSlawski

BillSlawski

    Honored One Who Served Moderator Alumni

  • Hall Of Fame
  • 15644 posts

Posted 03 October 2003 - 06:29 AM

Hi pvclink

Welcome to the forums.

I saw your question in the other post about having a site point at both http://www.mysite.com and http://mysite.com.

Check with your host, if someone is hosting your site. They should be able to tell you if they can switch that.

If you are on an apache server, and have access to use an htaccess file, it may be something that you can change. But, check with your host first, if you are hosted.

#21 DianeV

DianeV

    Honored One Who Served Moderator Alumni

  • Hall Of Fame
  • 7216 posts

Posted 03 October 2003 - 06:41 AM

I believe, on an Apache web server, that it needs to be done via the server configuration file -- httpd.conf. If you're on shared hosting, it's likely that your host will have to do this for you.

#22 pvclink

pvclink

    Ready To Fly Member

  • Members
  • 10 posts

Posted 03 October 2003 - 06:33 PM

^_^
ok this is the website of my company this is the address

http://www.sample.com.ph its working but i don't put any webpage yet
i'm the one doing that

here is my httpd.conf


NameVirtualHost 123.1.2.0


<virtualhost 123.1.2.0>
ServerAdmin root@sample.com.ph
ServerName mail.sample.com.ph
DocumentRoot /usr/share/squirrelmail
ErrorLog logs/gateway.sample.com.ph-error_log
CustomLog logs/gateway.sample.com.ph-accesss_log common
</virtualhost>
<virtualhost 123.1.2.0>
ServerAdmin root@sample.com.ph
ServerName www.sample.com.ph
DocumentRoot /var/www/html
ServerAlias sample.com.ph *.sample.com.ph
ErrorLog logs/gateway.sample.com.ph-error_log
CustomLog logs/gateway.sample.com.ph-accesss_log common
</virtualhost>


when i brows http://sample.com.ph

the error is this


The requested URL could not be retrieved

#23 pvclink

pvclink

    Ready To Fly Member

  • Members
  • 10 posts

Posted 03 October 2003 - 06:35 PM

Any wrong on my httpd.conf or I forgot something!!! :?:



thanks for help........ in advance ^_^

#24 pvclink

pvclink

    Ready To Fly Member

  • Members
  • 10 posts

Posted 08 October 2003 - 10:10 PM

I got it!!!!!! :)

its working now my website working http://mysite.com not only on www.mysite.com

i forgot something on my /etc/named.conf in i add this line don't forget to add
ur revers address zone folks on /var/named/


IN MS <complate domain name address>
IN A <My website ip address>
IN MX 10 <complate domain name address>
IN A <second domain ip address>

#25 robertassaf

robertassaf

    New To Community

  • Members
  • 2 posts

Posted 15 October 2003 - 12:00 PM

Help Please

I'm having all sorts of trouble with virtual hosting. I have 1 IP address and 2 domain names I want to host. www.leonardos.ca & www.organizedkaos.ca For some reason, when I type either of these addresses into a browser it automatically converts the name into my IP address. Contacted the company who hosts my DNS and they said its not on their end. I've read all the posts so far and messed with my conf file for hours with no luck.

The way I've got it set up, I've got www.leonardos.ca as the main server and then I am trying to set up www.organizedkaos.ca as the virtual host. Basically, both sites go to whatever is in the DocumentRoot folder in the Main Server config and the virtual host part is ignored. Here is a look at some of my settings in the conf file.

ServerName 1.2.3.4 or www.leonardos.ca (have tried both)

NameVirtualHost 1.2.3.4

<VirtualHost 1.2.3.4>
DocumentRoot C:Leonardosorganizedkaos
ServerName www.organizedkaos.ca
ServerAlias organizedkaos.ca *.organizedkaos.ca
</VirtualHost>

TIA

Rob

#26 Black_Knight

Black_Knight

    Honored One Who Served Moderator Alumni

  • Hall Of Fame
  • 9339 posts

Posted 15 October 2003 - 05:28 PM

Your server is using a HTTP 302 redirect to direct all visitors to the IP number.

Here's the HEADER response from your server at www.leonardos.ca:

Server Response: http://www.leonardos.ca 
Status: HTTP/1.1 302 Found
Date: Wed, 15 Oct 2003 22:26:45 GMT
Server: Apache
Location: http://24.101.137.75
Keep-Alive: timeout=10, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1 



#27 robertassaf

robertassaf

    New To Community

  • Members
  • 2 posts

Posted 15 October 2003 - 10:01 PM

Thanks for the quick response. Is there any way that you know of so I can fix the redirect problem?

TIA

Rob

#28 kouchou

kouchou

    New To Community

  • Members
  • 1 posts

Posted 05 December 2003 - 07:03 AM

I am a new user of linux .

SSLEngine OFF


How to disable php,session,.htaccess ,login for a web ?

#29 pvclink

pvclink

    Ready To Fly Member

  • Members
  • 10 posts

Posted 07 December 2003 - 09:57 PM

robertassaf

hello,

just read my info on forums about named.conf if u not add ip addrees on
name.conf u canno't add virtual domain

#30 pvclink

pvclink

    Ready To Fly Member

  • Members
  • 10 posts

Posted 07 December 2003 - 10:02 PM

robertassaf

But i'm amaze to linux you can done it on many ways very powerful and thanks to people around here giving input and brain storming i'm sure any one go here could get some better and better idia

thanks to the creator of this website.

#31 bigHairyBird

bigHairyBird

    New To Community

  • Members
  • 1 posts

Posted 15 January 2004 - 09:44 AM

To all,

My problem is such: When I start Apache with the virtual host entries seen below all document roots point to the one specified by the virtual host entry.

Why is my virtual server document root over-riding my default Apache/1.3.28 Server document root?

NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin [snipped email addy - John might not want the spam ;) ]
DocumentRoot /usr/local/www/data/dullknife/root
ServerName dullknife.com
</VirtualHost>

Any help would be severly appreciated!

bigHairyBird

#32 batmanu

batmanu

    New To Community

  • Members
  • 1 posts

Posted 26 May 2004 - 11:20 AM

Sorry, i am a newbie on this, but i hope i wouldn;t bother you too much with my stupid question :oops: .
Here's my problem: I have an Apache server behind a router, that was setup to forward the http requests to the internal IP of the machine with apache (of course). Since all the answers here are making everything very simple, I believe that's the cause for me not being able to setup the multiple hosting on my Apache server.

Please, help meeeeeeee ;)

#33 shanee86

shanee86

    New To Community

  • Members
  • 2 posts

Posted 08 August 2004 - 10:29 PM

Can anyine help me I am kind of new to hosting more than one site on a server.

I am trying to host www.shanee.dynu.com and www.sahnee86.dynu.com
as different site they are both subdomains.

This is my config of virtual hosts:
<VirtualHost :80>
ServerAdmin techman@cheaptechsales.com
DocumentRoot C:root
ServerName www.shanee.dynu.com
</VirtualHost>

<VirtualHost :80>
ServerAdmin techman@cheaptechsales.com
DocumentRoot C:root
ServerName shanee.dynu.com
</VirtualHost>

MY problem is it comes up saying this:
Forbidden
You don't have permission to access / on this server.


--------------------------------------------------------------------------------

Apache/2.0.49 (Win32) Server at shanee.dynu.com Port 80

Please help!!

#34 projectphp

projectphp

    Honored One Who Served Moderator Alumni

  • Hall Of Fame
  • 3935 posts

Posted 08 August 2004 - 11:05 PM

OK, 2 problems.

Firstly, the DocumentRoot is the same for both, meaning both sites share the same folder, so they will (eventually) serve the exact same documents. If you ewant them to be the same site, no problem, but rather than two entries, just put mutliple entries in ServerName.

Next, the forbidden either means:
1. You have no default document and the server wont show you what is in that folder.
2. That folder (c:root) is not allowed as a server location, i.e. you are not allowed to view these files from another computer. http://httpd.apache....mod_access.html has some info.

Try number one first, and report back if problems persist ;)

#35 picard

picard

    New To Community

  • Members
  • 1 posts

Posted 24 August 2004 - 07:19 AM

Man im sure this question has been asked before but here goes.

I have one ip address 121.158.224.246

I have 2 domains pointing to this ip

www.villainsclan.co.uk
www.sherryaid.com

Ok the www.sherryaid.com was an after thought and the apache server was set up for the villainsclan site, (dunno if it makes a difference)

I have read all the posts here, and im still having problems and it seems to be a common one. No matter what i do i can only see the villainsclan site and its driving me crazy :mad:

here is the 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 *>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>


<VirtualHost 212.158.224.246>
ServerAdmin admin@sherryaid.com
DocumentRoot "E:websitesSherryaidsherryLocal Publish"
ServerName www.sherryaid.com
serverAlias *.sherryaid.com
ErrorLog logs/comedy_error_log
# CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost 212.158.224.246>
ServerAdmin admin@villainsclan.co.uk
DocumentRoot "E:websitesvillains"
ServerName www.villainsclan.co.uk
serverAlias *.villainsclan.co.uk
ErrorLog logs/comedy_error_log
# CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

What have i missed or done wrong? I am a noob to this, so when you have picked yourself of the floor and you sides have stopped hurting please share your knowlege.

Picard, AKA Kev

#36 Sim-Very

Sim-Very

    New To Community

  • Members
  • 1 posts

Posted 27 April 2007 - 09:47 PM

Behold the power of google. brought me here hope i can still get help for this :S

it's simple like the others. i am using apache 2.2 winserv2k3 and godaddy
dunno exactly how im supose to set up dns but ill say what i have done so far


-------------------------------

went into the httpd.conf file and added this
<VirtualHost *:80>
	DocumentRoot "F:\www\don"
	ServerName streetscouts.com
	
</VirtualHost>

<VirtualHost *:80>
	DocumentRoot "F:\www\don"
	ServerName www.streetscouts.com
	
</VirtualHost>

<VirtualHost *:81>
   
	DocumentRoot "F:\www\mack"
	ServerName mackskateboarding.com
  </VirtualHost>

<VirtualHost *:81>
   
	DocumentRoot "F:\www\mack"
	ServerName www.mackskateboarding.com
  </VirtualHost>

and had my dns forward

mackskateboarding.com to http://myip:8080

that worked for a while... then sudently stopped. i reset up forwrding again and set my vhost as
<VirtualHost *>
	DocumentRoot "F:\www\don"
	ServerName streetscouts.com
	
</VirtualHost>

<VirtualHost *>
	DocumentRoot "F:\www\don"
	ServerName www.streetscouts.com
	
</VirtualHost>

<VirtualHost *>
   
	DocumentRoot "F:\www\mack"
	ServerName mackskateboarding.com
  </VirtualHost>

<VirtualHost *>
   
	DocumentRoot "F:\www\mack"
	ServerName www.mackskateboarding.com
  </VirtualHost>

and can see only the first site street scouts =\

am i missing a set?

#37 DianeV

DianeV

    Honored One Who Served Moderator Alumni

  • Hall Of Fame
  • 7216 posts

Posted 29 April 2007 - 12:46 AM

Well, I am not the world's greatest pro at server config files (and know zip about Windows servers), but it seems like you need to have something more than what appears to be a wild card in the <VirtualHost> tag (directive?).

But my first question would be: why did the first one stop working?

Edited by DianeV, 29 April 2007 - 12:47 AM.




RSS Feed

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users