Setting web testing server configurations after moving sites folder to new drive?

ian27

It all started at 3......
Hey guys,

Okay, this is driving me nuts! I have a number of PHP sites that I've created in Dreamweaver that I test locally using the software. I'm running Mac OS 10.3.8. I have testing server of http://127.0.0.1/~myusername/ etc etc.....

I'm running a bit low on hard drive space on my internal drive so I've purchased in larger external Lacie drive to store any additional information. I then made a copy of my "sites" folder and placed it on the new drive called "drive_a".

My problem is this:
How do I modify my site settings so that it will test the pages locally using the moved site folder as everything is configured for it to run from the internal drive? I tried modifying the url prefix but got completely lost with that. I then read that to test these files on an Apache testing server, I have to nominate a folder via the httpd.conf file. How do I do that?

I guess the main question I'm asking is can the above actually be done? And if so, how?

Many thanks,

Ian
 
Well, I don't know apache config well enough to know if you can add another external folder, but I do know how to change the root of the server. Currently it is /Library/WebServer/Documents (this is the folder that is used when you just go to http://localhost) if you edit the httpd.conf (MAKE A BACKUP FIRST) in /etc/httpd/ and change everywhere it says /Library/WebServer/Documents to the path of your disk (e.g. /Volumes/drive_a/Folder )
 
Hi HateEternal, thank you for your response. Well I found the httpd.conf document and modified the path as specified, then I turned Apache off and back on again to initialise the new settings but it didn't seem to change anything. I tried testing the pages via my external drive but it wouldn't work and it still seems to run the pages from the internal drive without any problems (which I thought it shouldn't be able to if I've specified a new path). I guess I'm having a bit of a thick attack here and am a completely incompetent Mac user. haha. Is it possible for you to step through this with me as I am obviously missing something (I am aware that you already have practically stepped through it with me, but I am just hoping that you may spot something from my reply). :)

Thank you.

Ian
 
If PHP etc is only installed on the internal drive, couldn't it be a problem with the PHP scripts? I don't know much about php but like in cgi scripts you sometimes have to edit the CGI path.
 
OK,

So if you make an html file called index.html and put some text like 'hi' or something like that in there then put it in the folder on your external drive that you set to the web root. Go to http://localhost/ does it show that html page?
 
Yea, you must go to the root of the domain, i.e. http://localhost too see the documents in the path you set in /etc/httpd/httpd.conf. The user directories (~myusername) will still point to your user's www home.
 
The best way to do it would be to create Virtual host for each of your site.
A virtual host directive in the httpd.conf file allows you to offer a variety of individual settings for that site. (One such being the doc root).

An example would be:

Code:
<VirtualHost *:83>
	ServerAdmin user@example.com
	DocumentRoot /path/to/webroot
	ServerName example.com
	ErrorLog logs/example.com-error_log
	CustomLog logs/example.com-access_log common
</VirtualHost>

In this case, you'd be using port 83. Thus, http://localhost:83 would go through to your webpage.
You can be tricky and create a host entry for each site and have sitename.localhost as the ServerName and use the "NameVirtualHost" option to switch between these virtualhosts by servername rather than port number.

As you can see, there's a fair bit too it.
Check out: http://httpd.apache.org/docs/vhosts/ for more info.

Good luck!!
 
Thanks guys. Whoa, yeah it does look to be very complicated. And I was thinking that I would just be able to move them to the new drive and they would play without any problems - who was I kidding?!? haha. Okay I'll give it a go over the weekend and see if I can figure it out using the above as a guide.

Your advice is very much appreciated.

Ian
 
Back
Top