So the short answer with reply is, "Sure, but WHY?!?"
The WebServer for Mac OS X (I'm assuming 10.6 Snow Leopard Client for the details of the answer) is based entirely on Apache. There are tonnes of web resources for Apache.
The key to Apple's Web Services are in /etc/apache2
You can (with admin privs) modify the httpd.conf (again; loads of web refs on this file) specifically pointing DocumentRoot anywhere.
However; and this is the list of caveats of why this is a weird thing to do...
- You have to be sure that the web process has the proper privs to read the directory in the location you may move it.
- You run the risk of something getting access to other files around the moved location
- This is non-standard configuration in the OS and is likely to break in a future verison
- The location is non-user volatile; meaning that deleting a user won't accidentally delete the served root folder. (Apache will fail to launch) if it can't find a served root folder
On top of this; we talk about moving the ~Sites. When you generate a new user acct; the OS generates a virtual directory conf in the /etc/apache2/users directory. Apache is smart enough to expand the ~ into a user name. All the above Caveats hold.
The question is why do you want the root folder on your desktop? It would seem to be more convenient to do one or more of the following:
- make an alias of /Library/WebServer/Documents on your desktop
- Setup groups/acls on /Library/WebServer/Documents to assure the correct write access
Without knowing why you're motivated to do this; I can't really hazard any other suggestions.
If it's a question of moving your web services directory to a network share... Now your solution is more along the lines of OS X Server (10.6) or doing your own apache install.
Good luck.
You have to be sure that the web process has the proper privs to read the directory in the location you may move it.
If you type brew info nginx
you should get answers to many of your questions. In particular, you should see something like:
To have launchd start nginx at login:
ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
Then to load nginx now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
So I expect if you link the plist to /Library/LaunchDaemons
instead of ~/Library/LaunchAgents
it will load at boot.
I don't know what you want to change, but it's the same nginx
as you use on Debian, so you can copy over your Debian nginx.conf if you want. Also the brew package comes with a set of default/example configuration files installed under /usr/local/etc/nginx/
.
The default conf runs on port 8080, so you have to edit it to run on port 80, and yes it will conflict with Apache running on port 80 so you have to turn Apache off or put it on another port. Apache config files are in /private/etc/apache2/
and you can turn it off via System Preferences -> Sharing -> Personal Web Sharing. (Note that this option has been removed in Mountain Lion. Mountain Lion still ships with Apache, but it is disabled by default.)
You can, of course, set it up however you want, but if you're looking for what's easy and Mac-like, just follow the Apache setup, which uses user and group _www
and uses /Library/WebServer/Documents
as document root and serves user content out of ~user/Sites
.
Best Answer
These are the only ones that I could find and recommend, since Urchin and Summary were discontinued.
Links/Resources