Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I test 3 sites having individual folders in htdocs?

Status
Not open for further replies.

bccamp

Technical User
Jan 20, 2005
69
0
0
I have a testing server with Apache 2063 & php5 on a Win XP machine that I use to test 3 different sites. Currently all files are served from htdocs, but the original files are saved in My Documents under "Site1", "Site2", "Site3". In htdocs, ALL the files for all 3 sites are in the 1 folder. Is there a way to split this up so they can be in their own folder in htdocs? Is there a way to reference the 3 individual folders in My Documents instead of serving through htdocs? In reading, I think this may be through an alias, but I'm rather new to apache, and am not sure exactly where to start, or even if this is possible. Can someone help me get started?
 
Hi

Virtual hosts ?
Code:
NameVirtualHost *

<VirtualHost *>
  ServerName site1
  DocumentRoot "c:/My Documents/Site1"
</VirtualHost>

<VirtualHost *>
  ServerName site2
  DocumentRoot "c:/My Documents/Site2"
</VirtualHost>

<VirtualHost *>
  ServerName site3
  DocumentRoot "c:/My Documents/Site3"
</VirtualHost>
Note that you probably will have to change those paths to the correct ones.
Code:
127.0.0.1    site1 site2 site3
See the Wikipedia article about Hosts file to find out where it is on your system.

Feherke.
 
Ok, thanks for the start. I'm still having a problem getting this to work. It's probably in the syntax, or my setup in Dreamweaver, but there are too many variables that I'm trying to chase. Here is what I've got so far:

Added:
Code:
<VirtualHost *:80>
  ServerName [URL unfurl="true"]www.mysite1.com[/URL]
  DocumentRoot "C:\Documents and Settings\MyProfile\My Documents\mysite1"
</VirtualHost>

<VirtualHost *:80>
  ServerName [URL unfurl="true"]www.mysite1.com[/URL]
  DocumentRoot "C:\Documents and Settings\MyProfile\My Documents\mysite2"
</VirtualHost>

Also added to the hosts file:
Code:
127.0.0.1 localhost

127.0.0.1  [URL unfurl="true"]www.mysite1.com[/URL]
127.0.0.1  [URL unfurl="true"]www.mysite2.com[/URL]

Now, in Dreamweaver, I still have the Testing Server folder pointing to the htdocs in the Apache Group folder and the URL prefix pointed to
Do I need to change the individual pointers to the respective My Documents folders, and should I change //localhost/ to those folders as well? Is my syntax correct on the ServerName? Thanks for the above post. I've gotten Apache to work with this, just can't get the webpages to display yet. Is my syntax correct on the ServerName?

Thanks again.
 
You have a typo or pasted wrong:

<VirtualHost *:80>
ServerName DocumentRoot "C:\Documents and Settings\MyProfile\My Documents\mysite1"
</VirtualHost>

<VirtualHost *:80>
ServerName <<<<<SHOULD BE DocumentRoot "C:\Documents and Settings\MyProfile\My Documents\mysite2"
</VirtualHost>
 
Thanks for the help. the mysite1 duplication was a typo. It is correct in my httpd.conf. I'm getting this error when I type the address (I changed the vh in the hosts file and the httpd file as not to confuse myself in accessing an external site, not my internal site):

Code:
Forbidden

You don't have permission to access / on this server.
Apache/2.0.63 (Win32) PHP/5.2.6 Server at vh.mysite1.com Port 80

When I test mysite1 using Dreamweaver, the page will show. When I test mysite2 using Dreamweaver, I get a 403 error. Like I said, I'm chasing so many variables, I don't know if I'm making it better or worse.
 
Ok, thanks. I was trying to make this much more difficult than it was, and I thought I was doing something different than I was actually doing. I thought I was creating a new DocumentRoot for each site I was testing. Once I figured out that was not the case, everyone's advice worked like it was supposed to. The only update I had to make to Dreamweaver was to list the URL as vh.site1.com for each site (changing the site1 name of course).

The only small hiccup I can figure out is one site has its pages in vh.site1.com/ When accessing that site through the browser, I must type the full url, including /www. But I can deal with that.

Thanks to everyone for the valuable information. I learned something new today.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top