Location, Location, Location: Tips for Storing Web Site Files
by Patrick Crowley05/16/2003
If you're like me, you've figured out how to install and configure your very own web development environment on Mac OS X. You've got Apache. You've got PHP. You've got MySQL (and phpMyAdmin, too). And, like a proud father, you've already cranked out a bunch of whiz-bang, dynamic web sites -- all on a Mac.
But, as your kids grow older, they're bound to go through some growing pains. And one of the first things you'll need to figure out is where to store your web site's files. Should they be in the Sites folder? The Documents folder? What are your options?
Here are three common approaches -- which address the needs of basic, intermediate, and advanced web developers.
Option 1: Use Your Sites Folder
Pros: No work requiredCons: Files must be stored in your Sites folder
|
Related Reading
Mac OS X in a Nutshell |
If you're just beginning to experiment with web development on Mac OS X, storing files in your Sites folder (AKA ~/Sites/) is definitely your best option. (Note: if you're already a Mac web-dev whiz, you can definitely skip this part.)
If you haven't already, make sure you enable Web Sharing (via System Preferences->Sharing), so that your copy of the Apache web server is fired up and ready to serve.
Once you've started web serving, to access any file or directory in your ~/Sites/ folder, just type 127.0.0.1 (also referred to as "localhost") into your browser, followed by your user name, and then the file or directory name you wish to access, like so:
~/Sites/ --------> http://127.0.0.1/~your_user_name/
~/Sites/site/ -----> http://127.0.0.1/~your_user_name/site
~/Sites/page.html ---> http://127.0.0.1/~your_user_name/page.html
Each time you start working on a new web site, all you need to do is create a directory for the new site, drag it into your Sites folder, and, voila, that site is now being served!
Option 2: Use Aliases
Pros: Serve files from anywhere on your MacCons: Need to know under-the-hood OS X stuff
So let's step things up a notch. Let's say you already have an existing file structure for your projects, and you're none too pleased about having to move everything over to the Sites folder. What do you do?
Easy! Just add a couple of aliases to your Apache config file (/etc/httpd/httpd.conf) and you'll be able to serve your web sites from wherever they happen to be located -- not just from the Sites folder.
There's one catch, though. Like many of OS X's UNIX underpinnings, your Apache config file is hidden from view. So the first thing you need to do is get a tool that will let you open the config file. To do this, you should use a text editor capable of opening and editing hidden files (like BBEdit) or, alternately, use a utility like TinkerTool that can enable the Finder to show all hidden files. (Note: it's always a good idea to back the config file up before making any changes.)
OK, so once you've got that sucker open, scroll down to the Aliases section and take a look. Here's how it should look:
Alias /icons/ "/usr/share/httpd/icons/"
<Directory "/usr/share/httpd/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
As you can see, each alias contains two parts: an Alias directive, which is the actual name used to access your site from the browser (as in http://127.0.0.1/alias), and then a <Directory> tag, which points to the actual location of the files you wish to serve.
Let's say you want to serve up some files from a project that's stored deep down in your Document directory, such as /Users/your_name/Documents/Clients/Client 4/site/. Just add a new set of Alias and Directive commands to your config file, like so:
Alias /icons/ "/usr/share/httpd/icons/"
Alias /client4/ "/Users/your_name/Documents/Clients/Client 4/site/"
<Directory "/usr/share/httpd/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/Users/yourname/Documents/Clients/Client 4/site/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Once you've made these changes, save your httpd.conf file and restart Apache (by turning Web Sharing off and then back on again in the Sharing pane in System Preferences).
Now, you should be able to access your new project by just entering http://127.0.0.1/client4/ straight into your browser! (And, of course, for each additional site you wish to serve from outside your Sites folder, just add a new Alias/Directory combo, restart your server again, and you're good to go.)
...
But wait, there's a catch -- and, if you're using PHP, it's an important one.
By default, PHP is configured to work properly with any files in your Sites directory. But should you serve files from a different location, you'll need to tweak your PHP configuration file, as well.
Now -- don't get scared on me -- the truth is Mac OS X, by default, doesn't have a php.ini file. So you'll actually need to make your own! But don't worry. It's easy.
- Add a lib directory to /usr/local/.
- Download a sample php.ini file from the PHP mothership.
- Rename the file you just downloaded to php.ini.
- Move the file to /usr/local/lib/.
Now that you're all set, open up your new php.ini file and scroll down to the Paths and Directories section, which should look like this:
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
First, remove the semi-colon in front of include_path, so that we can enable includes.
include_path = ".:/php/includes"
I know what you're thinking -- "Why do we need to tweak our include path, Patrick?" Well, dear Mac web developer, it turns out that PHP apps often rely on something called the include() command, which, you guessed it, allows PHP to include (or load) external files. Being a talented Mac OS X web developer, you'll probably wish to enable this feature at some point, either for use in other people's code or your own.
So, next, as you can probably guess, you need to add the directory from our earlier example to the include_path variable, so that PHP will work in this directory the same way it works in the Sites folder. (Use this trick each time you add a new alias to Apache's config file that might use PHP, separating each new include path with a colon, as in the example below.)
include_path = ".:/php/includes:/Users/your_name/Documents/Clients/
Client 4/site/"
Ok, that's it! You're now fully set up to serve both HTML and PHP files using aliases!
Option 3: Enable Virtual Hosts
Pros: Use customized URLs (no need for 127.0.0.1)Use absolute file paths
No php.ini editing necessary
Cons: Easy to screw up
But wait! There's more! This next option is the trickiest of the three, but it offers the greatest ability to make your local development server truly function like a production server.
And this gets to why I wrote this article in the first place. I had to figure out how to enable virtual hosts over the weekend -- and a thousand Google searches later, I realized that while there may be a cornucopia of documentation on Apache, MySQL, PHP, and the like, virtually none of it deals with Mac OS X! (Come on, people! Start documenting your experiences with this stuff, will ya?)
OK, with my rant out of the way, let's get busy with this virtual host stuff. Basically, with virtual hosts, a single Apache web server can serve multiple web sites from the same IP address. And not only that, you can actually use different, customized domain names for each web site.
In other words, instead of accessing files through 127.0.0.1, you can use a real (or simulated) domain name. So, to the untrained eye, your local web site will look like it's being served straight off the web — without any 127.0.0.1 gobbledygook.
Not only are there a lot of technical benefits to doing things this way (support for absolute file paths, no need to mess with PHP includes, etc.), but this stuff is perfect for client demos! You can run presentations straight off of your PowerBook and no one ever needs to know you're not on the Web.
Since this is exactly the sort of thing that many web developers on OS X really need, let's set up some virtual hosts!
To get started, scroll down to the very bottom of your Apache config file (/etc/httpd/httpd.conf) and find the NameVirtualHost section.
# Use name-based virtual hosting.
#
#NameVirtualHost
First, let's enable name-based virtual hosts, which we'll do by removing the # comment prefix from the last line.
# Use name-based virtual hosting.
#
NameVirtualHost
Next, let's specify the IP address to which our name-based virtual host names will resolve: which, of course, is our old friend 127.0.0.1.
# Use name-based virtual hosting.
#
NameVirtualHost 127.0.0.1
Now, we need to set up our VirtualHost directives. Using the example provided in the Apache config itself, we'll first add a virtual host for our existing Sites folder. We do this to ensure that we'll still be able to access web sites stored in the Sites folder using our existing 127.0.0.1-based addresses once we've enabled virtual hosts.
As you can see, we place 127.0.0.1 in the ServerName field, and then, with DocumentRoot, we specify where the files for our virtual host are stored -- the Sites folder.
<VirtualHost 127.0.0.1>
ServerName 127.0.0.1
DocumentRoot /Users/your_name/Sites
</VirtualHost>
With that behind us, we'll now add a VirtualHost directive using the same logic, but this time, we'll do it using my web site iCalShare as an example.
Since we still need to access the real iCalShare web site, we can't use the icalshare.com domain for our virtual host. If we did use that domain, whenever we entered icalshare.com into our browser, it wouldn't know whether to load the local site, or the external one.
Since this is a test server, we'll append a "test" subdomain to our primary domain name, making our complete server name test.icalshare.com. That name won't conflict with the existing iCalShare domain name, and it also tells us a little about the purpose of this server.
So let's place our new name in both the VirtualHost and ServerName tags. And, then, once again, we'll use DocumentRoot to point to the location of the files for this site, which are stored a few levels down in our Documents folder.
<VirtualHost test.icalshare.com>
DocumentRoot /Users/patrick/Documents/Projects/iCalShare/wwwroot
ServerName test.icalshare.com
</VirtualHost>
Now I bet you're asking, "How does my browser know that test.icalshare.com is a local request, and that icalshare.com is a remote one?" Good question! And the answer is ... because we're going to tell it!
The Web as we know it is actually strung together using IP addresses, not domain names. Each time you enter a web site domain name into your browser, it's actually translating that name into an IP address, which it does by checking with a DNS server. Once the DNS server finds an IP address match for the domain name you entered, you're magically transported to the web site you're seeking.
As it turns out, with Mac OS X, when you enter a domain name, your browser first checks with /etc/hosts to see if there's a matching IP address. If no match is found, the browser will forward the domain name on to a DNS server. So, by editing /etc/hosts, you can actually change where your browser goes when you enter various domain names. And this is exactly how we'll get your machine to recognize the virtual hosts we set up earlier.
So, open up your /etc/hosts file, and you should be looking at something like this:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
To enable the virtual host we set up earlier, just add a new entry to the file, as we've done below for our iCalShare example.
127.0.0.1 localhost
127.0.0.1 test.icalshare.com
255.255.255.255 broadcasthost
::1 localhost
For each virtual host you need, just create a new line that begins with 127.0.0.1, followed by a space or tab, and then the actual domain name.
So that's it! Save your /etc/httpd/httpd.conf and /etc/host files, restart Apache, and your vanity domain should now work like magic!
(Note: I've only touched the surface of all of the nifty things you can do with virtual hosts. Further reading on this topic is recommended.)
Final Thoughts
And, now patient readers, in the tradition of the great Jerry Springer, I leave with you a final thought ... get out there and go crazy with this stuff! And if you discover something cool in your web-development-on-OS-X travels, don't forget to share it!
Patrick Crowley is the creator of iCalShare, the iCal calendar directory, which was recently featured in Steve Jobs' keynote speech at Macworld San Francisco 2003.
Return to MacDevCenter.com
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 27 of 27.
-
Advice sought: Other than Default Hard disk
2006-02-14 21:39:52 WSG-Photo [Reply | View]
I have a huge website (containing pictures) that do not make sense to house them in the default hard disk. I like to set Apache to read website files stored in another hard disk, all inside the computer's other internal hard disk or external hard disk.
What can I do to set them in Mac OS X default system?
Is there any free utilities to make it easier?
Thank you in advance.
-
localhost and 127.0.0.1 seem to require a network connection
2004-04-20 16:52:49 patrick_ [Reply | View]
On my computer running os x 10.3. Localhost and 127.0.0.1 work great with a network connection. If I try to work from home where I don't have a network connection the local loop back doesn't work. Is there a way to use localhost without any net connection?
-
ln -s
2003-12-15 11:15:03 anonymous2 [Reply | View]
Hi, for me, the easy way to to that, is to work in my normal folders (no inside the ~/Documents) and then create an unix alias to the /Library/Webserver/Documents with'ln -s' command
Works like a norma mac alias, so ou can rename, etc, but also work like an unix alias, so you can put all your php, etc files, and test in your local machine, without having to make any modifications to your ini files, or config files...
[]s
fergussom
-
Virtual Domains on 10.3 server
2003-12-07 08:14:44 eprice [Reply | View]
This is the closest article I could find that might shed light on my current problem. I am a student so excuse the probable newbie question. I am running 10.3 server and my primary website has been live on the net for weeks with no problems. I registered a second domain and set the DNS using hn.org which seems to be working great.
When I enter the URL for either website they both bring up the index.html from the new site. Using the server admin application I created the second site and selected the web folder (document root) and the Default index file. Do I need to manually set virtual host settings for every site I create on OSX Server? I thought this would only be necessary if I were using client. TIA
http://www.pauleprice.com
http://www.ericswoodshed.com
-
Deleting ~username from url
2003-10-27 04:25:58 anonymous2 [Reply | View]
Greetings all, love the articles...have been a blessing.
I installed a BBS, Apache, MySQL etc and all works well. Also use dyndns to point to my iBox. Have located BBS in User/Sites but notice a ~username in the responding URL. Was wondering the best way to eliminate this a have a cleaner URL like www.mydyndns.net/mysite/mypix etc. Should I alias the BBS or move it back to root Webserver and reconfig the httpd.conf?
Regards, Scott G, KiwiLand
-
Name-based Virtual Hosts
2003-09-14 22:55:36 empass [Reply | View]
I found an easier way to do number 3 (above)
According to the Apache manual you can do the following; I did not modify the "hosts" file. Also see the documentation about mass virtual hosting. (see apache.org and search for terms)
# example
NameVirtualHost 111.22.33.44
<VirtualHost 111.22.33.44>
ServerName www.mysite1.com
ServerPath /web
DocumentRoot /web/mysite1
</VirtualHost>
<VirtualHost 111.22.33.44>
ServerName www.mysite2.com
ServerPath /web
DocumentRoot /web/mysite2
</VirtualHost>
<VirtualHost 111.22.33.44>
ServerName www.mysite3.com
ServerPath /web
DocumentRoot /web/mysite3
</VirtualHost>
# end example
It DOES work with the same IP for all three.
I also used a DNS Service (free for 5) to register the name servers @ http://www.zoneedit.com
Hope this helps.
-
Contextual menu makes symbolic links inside Finder
2003-07-25 09:03:34 lixlpixel [Reply | View]
"SymbolicLinker.plugin"
this little contextualMenu Item lets you create "symbolic links", which work like Alias directives, right in the finder.
works perfect (at least for me) with PHP and looks like a "real" subdirectory .(http://YOUR_IP/SYMBOLIC_LINK/)
the symblic link can even point to files or folders on external disks, apache will treat it like the original.
(just don't move the target file - symbolic links don't update themselves like the "alias" in finder)
i found it @
http://www.versiontracker.com/dyn/moreinfo/mac/17655
-
Great Article!!
2003-07-22 09:16:36 anonymous2 [Reply | View]
Just wanted to say thanks! This is a great article! I have been impressed with O'rielly's coverage of OS X Apache, PHP, MYSQL, etc.
The authors have done a fantastic job at covering the material. A local development environment has proven to be very effective for me! and It's been cool to see how it all works. This article addressing the VHosts was a great progression in the series. Keep up the good work!!!
- cb
-
more on the 403 error.
2003-07-18 06:04:35 anonymous2 [Reply | View]
Great article! I tried to do this and it works if I put my website in the Sites folder:
<VirtualHost test.koen.com>
DocumentRoot /Users/koen/Sites/MyWeb
ServerName test.koen.com
</VirtualHost>
If I put it somewhere else, which is I guess the purpose of using virtual hosts, I get an 403 error:
<VirtualHost test.koen.com>
DocumentRoot /Users/koen/Documents/HTML/MyWeb
ServerName test.koen.com
</VirtualHost>
any ideas what might be the problem?
thanks,
- Koen.
-
What if site is hosted on my computer and I have a router?
2003-06-12 07:04:50 anonymous2 [Reply | View]
Does any of this change if the site is hosted on my computer?
I have an additional problem that I can't use http://mydomain.com because of the Netgear Router. http://mydomain.com brings up the Netgear set up. So to see my site, I have to use mycomputer.local, but some things are difficult to deal with. Particularly confusing when I'm trying out things like WebCalendar and the config.php file needs to be different if I access the site from within or outside.
Any thoughts?
-
HUH?
2003-06-05 14:27:22 anonymous2 [Reply | View]
Why do you have to go through all this just to serve a website from your Mac?
Seems to me it would be a lot easier and more secure, on OS 9....
Help me out here.
-
php.ini
2003-06-04 03:58:37 anonymous2 [Reply | View]
Thanks for a great article!
I would like to know how one changes the expected location of the php.ini file. Most docs and refs (including this article) say it should be placed in usr/local/lib but my PHP installation looks for the config file in /usr/lib. (I found this by checking php(info) after having become just a little frustrated when 'Includes' wouldn't work for any new paths I specified in php.ini)
Is this default location for php.ini something that is set at compile time? Can I change it to be usr/local/lib now? If so, how?
-
alias (itunes music library)
2003-06-02 18:21:33 anonymous2 [Reply | View]
I am trying to give access to my itunes music library /user/user_name/music/itunes/itunes music/ on my webpage. Apache Webserver is looking for the files here here /documents/ located in my webserver folder under my library. How can I get it to let me give access to it.
-
Virtual hosts
2003-05-28 03:18:19 elektron [Reply | View]
an empty "NameVirtualHost" is unnecessary. All you need is "NameVirtualHost *". Or, in Sodium's case,
NameVirtualHost *:80
NameVirtualHost *:8080
because some ISPs suck. Port 80 is still used just because it feels proper.
<VirtualHost test.icalshare.com> is equivalent to <VirtualHost 127.0.0.1> because Apache only looks at the IP in <VirtualHost>. The "Host" header (or server portion of the request line) is compared to ServerName. And when virtualhosting to the rest-of-world, unless you have a static ip or a nameserver that tells you who you are when you get connected, it's best to use <VirtualHost *>.
If you do, however, use <VirtualHost *>, all requests that don't match a VirtualHost will match the first wildcard VirtualHost. To stop this from happening, the first virtualhost should be
<VirtualHost *>
</VirtualHost>
to set the default DocumentRoot and stuff to everything you painstakingly configured in the rest of httpd.conf.
And thirdly, you just need one line for each ip address in the hosts file, e.g. "127.0.0.1 localhost me myself i test.icalshare.com". lookupd doesn't consult /etc/hosts by default in 10.1.5, though, so it's a lot of playing with netinfo (i don't remember if you could click a box to tell it to consult the flat files).
I don't worry about Apple overwriting my httpd.conf, mainly because I set apache2 to run instead.
-
add rendezvous names
2003-05-20 12:16:16 anonymous2 [Reply | View]
if you develop on a local network, it can be really handy to add rendezvous names for virtual hosts or even directories.
For example if you add:
RegisterResource "icalshare" /Users/patrick/Documents/Projects/iCalShare/wwwroot
at the end of your httpd.conf file (providing you are running 10.2.5+) the site will show up in Safari or Camino's Rendezvous menu as "icalshare"
-
Virtual Hosts & Content Negotiations
2003-05-20 03:46:19 senjaz [Reply | View]
Has anyone else had problems with content negotiation in conjunction with virtual hosts?
It only appears to work with the root site. I've tried putting the directives inside the virtual host tags too.
-
Great article
2003-05-20 01:57:28 anonymous2 [Reply | View]
I tried to do something similar and got it working, but couldn't repeat it. The clarity of this article is really helpful... Covering both aliases and virtual hosts (including the /etc/hosts file - which I had missed) - GREAT!
-
another VirtualHosts article
2003-05-19 08:23:19 anonymous2 [Reply | View]
There's another article about VirtualHosts for OS-X (the author must have missed it) on evolt.org - it's been there for a while too (nearly two years).
Here
It's been helpful to me!
-
DynDNS has a good tutorial
2003-05-19 02:28:31 anonymous2 [Reply | View]
I actually followed the small tutorial on DynDNS and it seems it is working according to my friends except for one thing. http://myvirtualhost.com/ and http://myipnumber/ both point to my first virtual host in the list, myvirtualhost.com. but the other http://myothervirtualhost.com/ point to the account it is supposed to.
I had some initial problems with apache restarting but I found if I turned off Web Sharing first then did the edit it came on no problem. It also seems to be a simplified version of this. check it out.
https://www.dyndns.org/support/kb/apachevhosts.html
-
Forbidden 403 Error on Virtual Hosts?
2003-05-18 23:39:54 anonymous2 [Reply | View]
I have been through the directions 3 times and can't figure what I messed up. I have three separate virtual domains setup in both etc/hosts and httpd.conf. All provide the same error message.
Do I need to add "Allow from all" to the master <Directory> section? This already appears under the root document directory and in
"Include /private/etc/httpd/users" which is the last line of httpd.conf
Suggestions please.
-
Visiting your virtual sites from another computer
2003-05-18 19:17:44 wkolean [Reply | View]
Good article! Sometimes, however, you need to check your site on another computer, like a PC, and it doesn't seem to work if you only use 127.0.0.1. If you have a fixed IP address, you can add your IP address to NameVirtualHost:
NameVirtualHost 127.0.0.1 192.168.1.100
and then add your IP address to each VirtualHost:
<VirtualHost test.icalshare.com 192.168.1.100>
...
</VirtualHost>
Finally, if you want to test your site on a PC, edit your HOSTS file, which for Win2000 is in C:\WINNT\SYSTEM32\DRIVERS\ETC
and add:
192.168.1.100 test.icalshare.com
-
Use NetInfo Manager instead of /etc/hosts and other comments
2003-05-17 15:34:05 maarky [Reply | View]
For me it's easier to open NetInfo Manager rather that looking for a hidden file. So instead of directly editing your /etc/hosts file you can go to /Applications/Utilities/NetInfo Manager
Once you launch NetInfo Manager you will click on "machines" and then "localhost". Now you want to click on the lock in the bottom left corner so that you can edit the info (must be an admin user). Now duplicate "localhost" and rename the duplicate whatever you want your virtual host to be named. So for instance, you change "localhost copy" to "test.icalshare.com".
Now deselect your new machine by clicking on another one. It will ask you if you really want to make the change. Say yes. There you go.
Another thing. I don't know the wisdom of this but I got it from the apache documentation ( http://httpd.apache.org/docs/vhosts/name-based.html ) and I have had no issues with it. You do not need to specify 127.0.0.1 in your virtual host directives. All you need is "*". For example, the following should work just fine:
NameVirtualHost *
<VirtualHost *>
DocumentRoot /Users/patrick/Documents/Projects/iCalShare/wwwroot
ServerName test.icalshare.com
</VirtualHost>
You can also add other directives inside your virtual host directive. For example, do you want each of your virtual hosts to have its own php include path? Do you want to add a domain specific alias? If so do this:
<VirtualHost *>
DocumentRoot /Users/patrick/Documents/Projects/iCalShare/wwwroot
ServerName test.icalshare.com
<IfModule mod_php4.c>
php_value include_path "Users/patrick/Documents/Projects/iCalShare/"
</IfModule>
Alias /manual/ "/Library/WebServer/Documents/manual/"
<Directory "/Library/WebServer/Documents/manual">
Options FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
There's plenty of other stuff you can put in there too.
I have also noticed that with these virtual hosts they are case sensitive. Taking the above example, "http://test.icalshare.com" will work, but "http://test.iCalShare.com" will not. Also, if you name you virtual host "php.mac" then "http://php.mac" will work, but "http://www.php.mac" will not. But if you name your virtual host "www.php.mac" then the opposite is true.
As a side note I have gone kinda crazy with virtual hosts since getting os x. I downloaded the PHP documentation Web pages and made a virtual host for that and the same for mysql documentation, phpmyadmin and so on. The convention I have used for tld's is .mac There is no .mac tld so I don't have to worry about it conflicting with real domains. So, if I want my php documentation I go to "http://php.mac"
-
Don't forget to NameVirtualHost
2003-05-17 13:38:02 coyote4til7 [Reply | View]
Apache likes to be not just told how to handle test.icalshare.com, but asked to handle it. If you don't ask it to handle it before telling it how, it'll complain on restart and might even mis-handle some sites.
First, scroll just above the VirtualHost directives and add a NameVirtualHost directive:
NameVirtualHost test.icalshare.com
Then restart Apache: sudo apachectl restart
You can also restart apache via System Preferences, but by doing it at the command line, you'll get to immeadiately see any errors that stopped Apache from starting.
-
Easier way to view hidden files
2003-05-17 09:57:11 Ken Williams |
[Reply | View]
In the Finder, you can navigate to any hidden directory by using the "Go to Folder..." menu command in the "Go" menu. For instance, to look at /tmp/ (which I do frequently), just type /tmp/ in the "Go to Folder" pop-up sheet. You'll see its contents in a regular Finder window.
-Ken
-
Option 1 (~/Sites folder) BADLY wrong???
2003-05-17 09:56:52 anonymous2 [Reply | View]
The article says:
for ~/Sites/ --> http://127.0.0.1/
But that will serve the files in /Library/WebServer/Documents (the webserver's DocumentRoot), not those in ~/Sites/. For access to a user's Sites folder, you need:
http://127.0.0.1/~username/
with subdirectories and filenames appended to that base. Otherwise, on a multiuser machine how would apache know whose Sites to show?
If I am right (99% sure) please correct the article!!!
-
Name-based virtualhosting made easy
2003-05-16 18:48:19 opatrickly [Reply | View]
I have written a script that I use to add name-based virtualhosts to my Mac OS X machine. It uses NetInfoManager to add the name into the system, and Apache's NameVirtualHost directive. All the virtualhosts the scripts add are strictly local, so you don't have to worry about others snooping about your work. If you care to try it out, you can read more about it here: http://patrickg.com/virtualhost
Patrick






I'm running Mac OS X and trying to do the solution for part II - I have cd into /usr/local/ and have tried to mkdir lib but keep getting a permission denied response from Terminal. I know I can changer permissions via chmod but 1. don't think I will be able to do this to this dir 2. don't know if that is a good idea given the dir ... Also, the link to the php.ini file is broken.
I'm just doing this for person dev on my Mac before pushing the files to a remote server ... any help is much appreciated and please let me know if any more information is required. Thanks!