 |
 |
Multiple local sites for development, Apache2 Config
|
 |
|
 |
|
Junior Member
Join Date: Jun 2003
Location: Bergen, Norway
Status:
Offline
|
|
Ok, just reinstalled my powerbook and did a nice clean install of Serverlogics complete packages for Apache 2, MySQL and PHP. These work fine, and I'd recommend them to anyone...
However, I do have an issue that I seem to need some help on. I'm always working on the development of more than one site at once, and I'd like to be able to work locally on all of these, through different URLs. All development are done on PHP-Nuke based sites, so they all need MySQL access.
For instance, I'd like "http://local.the-site-i'm-working-on.com" to be one site, "http://local.the-site-i'm-working-on2.com" to be another, and so on.
I was hoping to accomplish this through some "hosts"-file configuration in order to bypass DNS lookup for "http://local.blah-blah-blah.com" (where the "real" site would be "http://www.blah-blah-blah.com"), combined with some virtual-multi-site-configuration of the httpd.conf file.
So if anyone knows how this can be done, or some reason why it can't be done, I'd appreciate a quick guide as to how...
Thanks!
|
|
Hallvard Opheim
Dual 2GHz G5, 9800Pro, 2.5GB, BT, iSight
PB17 1GHz, 1GB
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Dec 2002
Status:
Offline
|
|
I tried editing my hosts file to do that, and it didn't seem to work. I wanted 127.0.0.2 to direct to the dev server, and 127.0.0.1 to be the live server. I accomplished it using a virtual host thru apache's config files, and manually setting an alias via ifconfig (terminal). Still passively looking for a better way, as I have to re-set the alias after reboots/log-outs.
|
|
Travis Sanderson
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Jun 2003
Location: Bergen, Norway
Status:
Offline
|
|
Ah, right.
I tried before I reinstalled, and was able to get the "http://local.*" URLs to all point to 127.0.0.1. However, I was unable to configure the Apache server to display different directories based on those URLs, so I'd get the same page, no matter which URL I entered.
I have a folder "Web Development", under which all the sites I work on has its own folder. Under this folder, I have "graphics dev", "content dev" and "htdocs" (and some other unimportant). What I would like is for each of the local.* URLs to point to its respective htdocs-folder.
Is it possible....
I'll sit down and glance at the docs once more as soon as I get the time...
|
|
Hallvard Opheim
Dual 2GHz G5, 9800Pro, 2.5GB, BT, iSight
PB17 1GHz, 1GB
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Aug 2002
Location: Chicago
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Jun 2003
Location: Bergen, Norway
Status:
Offline
|
|
THANK YOU!
I found O'Reillys to be the easiest one to follow. The third option "Enable virtual hosts" was the one I was looking for, and after some testing, it worked like a charm!
I spent the last half hour creating my own little tutorial for this, but it seems that the vB Code stuff doesn't work properly here, so most of my tags disappeared... Oh well, I've put it up on a web page instead... If you need it, you'll find it here:
http://dintelefon.net/temp/virtualhosts.html
|
|
Hallvard Opheim
Dual 2GHz G5, 9800Pro, 2.5GB, BT, iSight
PB17 1GHz, 1GB
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Aug 2002
Location: Chicago
Status:
Offline
|
|
Looks like I'll be doing some work these weekend trying these configurations.
Thanks for the tutorial opheim
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Aug 2002
Location: Chicago
Status:
Offline
|
|
I tried it last night but couldn't get far.
I found the files that I need to modify but
I cannot save the changes to the /etc/httpd/httpd.conf and /etc/hosts files
I tried textedit, hydra, Bbedit Lite and none of them lets me save the changes.
I know it has to do something with permissions.
Anybody have any suggestions or detailed instructions?
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Jun 2003
Location: Bergen, Norway
Status:
Offline
|
|
Hi!
Hm... I used BBEdit for editing the file. If you've installed Apache 2 from ServerLogistics, then the httpd.conf is located at /Library/Apache2/conf/httpd.conf. This file does not require root access. You can also edit it directly from their Preference Pane, using your favorite editor.
If you need root access for your httpd.conf, then doing a "sudo vi /etc/httpd/httpd.conf" would do the trick from terminal, if that's the path for your conf-file.
|
|
Hallvard Opheim
Dual 2GHz G5, 9800Pro, 2.5GB, BT, iSight
PB17 1GHz, 1GB
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Jun 2003
Location: Bergen, Norway
Status:
Offline
|
|
Oh, and if you need to use one of the editors you mentioned, than changing the ownership of the file temporarily would do the trick.
Do a:
sudo chown $username /etc/httpd/httpd.conf
...and enter your root password.
In order to change it back, just do a:
sudo chown root /etc/httpd/httpd.conf
...and enter your password.
|
|
Hallvard Opheim
Dual 2GHz G5, 9800Pro, 2.5GB, BT, iSight
PB17 1GHz, 1GB
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Aug 2002
Location: Chicago
Status:
Offline
|
|
Okay I need a little bump here
I have modified /Library/Apache2/conf/httpd.conf also the etc/host file
Turned off web sharing and did a Graceful restart of Apache 2
With web sharing off I get this:
Not Found
The requested URL / was not found on this server.
Apache/2.0.47 (Unix) DAV/2 PHP/4.3.2 Server at dev.hannahhayes.com Port 80
With URL http://dev.hannahhayes.com/
===============
With web sharing on and Apache 2 off I get this:
If you can see this, it means that the installation of the Apache web server software on this system was successful. You may now add content to this directory and replace this page.
With URL http://dev.hannahhayes.com/
===============
It finds the address but not the pages. Here is my Sites folder content
Sites/index // Original file from Mac OS X
hannahhayes/index.hmlt // Inside Sites
httpd.conf // File made from Apache 2 inside hannahhayes
Also another configuration
Sites/index
dev/hannahhayes/index
httpd.conf // File copied from Apache 2
Now here are my questions:
Do I have the right format with the Sites folders?
Sites/index and /hannahhayes/index
or
Sites/dev/hannahhayes/index
And where should the httpd.conf be? In the Sites folder
I know I’m missing a little piece here. If anybody has any suggestions? Opheim?
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Jun 2003
Location: Bergen, Norway
Status:
Offline
|
|
Ok, first off, you must turn off the "Personal Web Sharing" from the built-in preference pane "Sharing". This affects only the built-in Apache 1.3.x that comes with Mac OSX. Since you've installed the Apache2 from ServeLogistics (i presume), that is the server we'll concentrate on.
The httpd.conf file is located in, and should not be removed from, the "/Library/Apache2/conf/" folder. When you want to edit the Apache configuration, use the "edit"-button found in ServeLogistics PreferencePane, in your System Preferences. Whenever you make changes to the file, you'll need to gracefully restart the apache server.
The filestructure should be as follows:
/Users/$username/Sites
/Users/$username/Sites/index.html (default)
/Users/$username/Sites/images/ (default)
/Users/$username/Sites/dev.hannahhayes.com/
/Users/$username/Sites/dev.hannahhayes.com/index.html
If you use this file structure, then your httpd.conf VirtualHosts configuration should be like this:

Remember to replace the "$username" with your own username, of course.
Your /etc/hosts file should have an entry like this:
127.0.0.1 dev.hannahhayes.com
Hope this helps... 
|
|
Hallvard Opheim
Dual 2GHz G5, 9800Pro, 2.5GB, BT, iSight
PB17 1GHz, 1GB
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Aug 2002
Location: Chicago
Status:
Offline
|
|
Thanks opheim I'll try it tonight
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|