Author |
|
nuketighten
Joined: 13 Nov 2005 Posts: 13
|
Posted: Sun 13 Nov '05 22:48 Post subject: Hosting multiple domains on a single server with the same ip |
|
|
How do i host multiple domains on the same server using the same ip address.
so far i am haveing a lot of trouble doing this.
this is what i vhost file looks like so far how do i fit things?
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at <URL:http://www.apache.org/docs/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
#Use name-based virtual hosting.
#
NameVirtualHost **.**.**.**: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 www.vortexx.org>
ServerAdmin admin@php.vortexx.org
DocumentRoot C:\virtualhosts\vortexx
ServerName php.vortexx.org
ErrorLog logs/php.vortexx.org-error_log
CustomLog logs/php.vortexx.org-access_log common
</VirtualHost>
#<VirtualHost **.**.**.**:80>
# ServerAdmin admin@php.vortexx.org
# DocumentRoot C:/vortexx
# ServerName php.area51music.org
# ErrorLog logs/php.vortexx.org-error_log
# CustomLog logs/php.vortexx.org-access_log common
#<VirtualHost>
#ServerName www.vortexx.org
#DocumentRoot C:/ProgramFiles/EasyPHP1-8/www/vortexx
#</VirtualHost>
#<VirtualHost **.**.**.**>
#ServerName www.area51music.org
#DocumentRoot C:/ProgramFiles/EasyPHP1-8/www/html
#</VirtualHost>>
#alias
#alias |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3046 Location: Hilversum, NL, EU
|
Posted: Sun 13 Nov '05 23:12 Post subject: |
|
|
You do not tell what kind of troubles you have.
Just try the following vhost config and tell if that works:
# The first VirtualHost section is used for requests without a known
# server name. I just called it unknown (you can leave that the same)
NameVirtualHost *
<VirtualHost *>
ServerName unknown
DocumentRoot C:\virtualhosts\unknown
</VirtualHost>
<VirtualHost *>
ServerName www.vortexx.org
DocumentRoot C:\virtualhosts\vortexx
</VirtualHost>
<VirtualHost *>
ServerName www.area51music.org
DocumentRoot C:/ProgramFiles/EasyPHP1-8/www/html
</VirtualHost>
...
...
...
Steffen |
|
Back to top |
|
nuketighten
Joined: 13 Nov 2005 Posts: 13
|
Posted: Sun 13 Nov '05 23:26 Post subject: trouble |
|
|
when i make the changes to the file and go to save it. i restart apache and get errorssaying things like:
synatx error on line 1088 of c:/program files/easyphp1-8/conf/httpd.conf:
documentroot takes one argument, Root directory of the document tree""
I am new to apache and mysql. so I am a newbie.
does my file look right? |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3046 Location: Hilversum, NL, EU
|
Posted: Sun 13 Nov '05 23:31 Post subject: |
|
|
Once we were all newbee, therefore I like to help
No typo or "old" stuff you put in ?
What is on line 1088 ?
Steffen
ps.
Still a problem, send you conf to me by mail. |
|
Back to top |
|
nuketighten
Joined: 13 Nov 2005 Posts: 13
|
Posted: Sun 13 Nov '05 23:37 Post subject: |
|
|
what is your e-mail address |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3046 Location: Hilversum, NL, EU
|
|
Back to top |
|
nuketighten
Joined: 13 Nov 2005 Posts: 13
|
Posted: Mon 14 Nov '05 7:55 Post subject: apache and sql |
|
|
Man I am so lost. And I am not sure if anyone can help me. I put in what you said and it worked. Then i started playing with phpmyadmin to add the database and everything went to hell. both domains stoped working and since then i can't get them back working. Also i was going to deleta all the databases and start new but, It wouldn't let me delete them. any idea what i could do but start over? |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3046 Location: Hilversum, NL, EU
|
Posted: Mon 14 Nov '05 18:49 Post subject: |
|
|
Strange.
I see that you are installed/using easyphp ?
I am not familar with easyphp and do not know what they added/changed. I heard more that builds like easyphp are not that easy.
Better is install a "clean" version from http://httpd.apache.org/ , there is a very good install guide at http://mpcon.org/apacheguide/index.php which is based on the latest releases.
When you have issue please open a new topic (this topic is about vhosts)
Steffen |
|
Back to top |
|
noblecomputing
Joined: 18 Nov 2005 Posts: 3
|
Posted: Sun 20 Nov '05 17:52 Post subject: |
|
|
very simple .. use this format
NameVirtualHost 192.168.1.254:80 #Whatever your ip address is
<VirtualHost 192.168.1.254:80>
ServerAlias www.domain.com domain.com
DocumentRoot "c:/web/xampp/htdocs/web"
DirectoryIndex index.php
</VirtualHost>
<VirtualHost 192.168.1.254:80>
ServerAlias www.domain2.com domain2.com
DocumentRoot "c:/web/xampp/htdocs/web"
DirectoryIndex index.php
</VirtualHost> |
|
Back to top |
|
nuketighten
Joined: 13 Nov 2005 Posts: 13
|
Posted: Wed 23 Nov '05 22:48 Post subject: |
|
|
Ok does it matter what i am running?
i am running easyphp 1.8
Apache 1.3.33,
PHP 4.3.10,
MySql 4.1.9
phpMyAdmin 2.6.1.
will that set up that you gave me matter? |
|
Back to top |
|
noblecomputing
Joined: 18 Nov 2005 Posts: 3
|
Posted: Thu 24 Nov '05 5:55 Post subject: |
|
|
nuketighten wrote: | Ok does it matter what i am running?
i am running easyphp 1.8
Apache 1.3.33,
PHP 4.3.10,
MySql 4.1.9
phpMyAdmin 2.6.1.
will that set up that you gave me matter? |
Negative .. Just change the path and your ip's |
|
Back to top |
|
nuketighten
Joined: 13 Nov 2005 Posts: 13
|
Posted: Fri 25 Nov '05 7:52 Post subject: Does this look right? |
|
|
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at <URL:http://www.apache.org/docs/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost **.**.*.*:80 #Whatever your ip address is
<VirtualHost **.**.*.*:80>
ServerAlias www.bayareahostinghut.com bayareahostinghut.com
DocumentRoot "C:/virtualhosts/bayareahostinghut/html"
DirectoryIndex index.php
</VirtualHost>
<VirtualHost **.**.*.*:80>
ServerAlias www.area51muisc.org area51music.org
DocumentRoot "C:/virtualhosts/area51music/html"
DirectoryIndex index.php
</VirtualHost>
# Other directives here
#</VirtualHost>
#alias
#alias |
|
Back to top |
|
Brian
Joined: 21 Oct 2005 Posts: 209 Location: Puyallup, WA USA
|
Posted: Sat 26 Nov '05 19:56 Post subject: |
|
|
Howdy,
Maybe I am missing something here, but isn't it as easy as:
Code: | <VirtualHost *>
ServerName www.somedomain.com
ServerAlias somedomain.com *.somedomain.com
DocumentRoot "x:/path/to/vhost"
DirectoryIndex index.php index.html index.htm
</VirtualHost> |
.... for setting up vhosts. I hope so because that is how I have done all 520 or so that I have, running on a single IP.
Also, having never used Apache 1.x on Windows, I can only mention what I have read ... definately upgrade to newest 2.x if you can. You can run mutliple instances of apache so you could set up 2.x on a different port, on the same server as your production server. This is actually sort of nice since you can easily use some of the configuration file information from your current production server to help build the new upgraded server.
Plus no down time for your production server ; )
PHP 4.x is up to 4.4.1 as of this post and MySQL is up to ... I dunno but you could install the new version 5 I suppose. I use MySQL 4.1.11 but I think that .14 or higher is out. That is if you use MySQL of course.
Steffen helped me out on this subject. I now run a separate server on port 88 which is a testing server, though it accesses all the same vhosts and has the same basic config, allowing me to test changes before implementing them on the production server.
I also must agree with Steffen on a clean install. I have used things like Big Apache, thinking that it is really nice that they do all the work for me. I think servers installers fail to teach you much, and it is always best to build from scratch as a newbie. Just my thoughts : )
--
Brian |
|
Back to top |
|
BLU3Fi5H
Joined: 26 Feb 2010 Posts: 1
|
Posted: Fri 26 Feb '10 3:25 Post subject: |
|
|
I am running Apache 2.2.14 (installed to drive E: in case it causes any confusion) on XP and trying to get 2 sites hosted on one ip.
When i set up the httpd-vhosts.conf file, i end up only seeing the first one on the list. If i reverse them i see which ever is first on the list of virtual servers.
I have looked all over the internet and followed everyone's advice and still cant seem to get it to work.
Here is my httpd-vhosts.conf (with addresses renamed to one and two):
NameVirtualHost *
<VirtualHost *>
DocumentRoot "E:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
ServerName www.one.net
ServerAlias one.net *.one.net
</VirtualHost>
<VirtualHost *>
DocumentRoot "E:/Program Files/Apache Software Foundation/Apache2.2/htdocs/two"
ServerName www.two.net
ServerAlias two.net *.two.net
</VirtualHost>
If i put two first, only two is displayed, if i put one first, only one is displayed. |
|
Back to top |
|