How do I move the Library/WebServer/Documents folder, which contains files shown by http://localhost ? For instance, to the Desktop. Also, can the ~/Sites folder be moved too?
How to move the web server folder for web sharing
apachewebserverwebsites
Related Question
- MacOS – Web Sharing Apache Localhost – Access permissions
- MacOS – OS X Lion – How to configure website on Apache
- MacOS – Change Web Sharing “Sites” folder to SkyDrive
- Folder displaying in terminal but not finder
- How to set up “localhost” document root as Mac’s “Sites” folder with MAMP PRO 4
- MacOS – Solve /Users/theusername/Sites/foo ~/bar localhost/~theusername High Sierra Apache server connection Internal Server Error
Best Answer
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...
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:
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.