Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

So far, I read on MacRumors of:

System-wide site

Files at /Library/WebServer/Documents will, by default, be shared as the root Web site when Web sharing is turned on. These files can be accessed at http://localhost/ or http://<yourIPaddress>.

User-specific sites

Files at ~/Sites, or in your home folder's Sites folder, are considered your user-specific site files. Each user by default has one of these folders. Each user's site can be accessed at http://<yourIPaddress>/~(shortusername).

It's all depicted when activating Web Sharing:

Web Sharing

But my static files are in a different folder, so I would like to serve them from ~/Projects/js-spa instead of from ~/Sites, but reading about configuring Apache, I can't find /etc/httpd/httpd.conf on Lion.

How can I configure where do I want to serve the personal website from?

share|improve this question
1  
If you're up for it, httpd.conf should be in /etc/apache2/ on Lion/ML –  Cathy Jan 10 '13 at 2:26
add comment

2 Answers

up vote 0 down vote accepted

If you're up for it, httpd.conf should be in /etc/apache2/ on Lion/ML. Some mac-centred help is at this blog.

Have a look at "How to turn Mac OS X Lion into a web server?" for instructions on the Web Sharing pane, and doing similar things in Terminal under Mountain Lion.

share|improve this answer
add comment

As Cathy mentioned, you can accomplish this in Lion/Mountain Lion in just 3 easy steps:

  1. open /etc/apache2/httpd.conf in your favourite editor (sudo it)
  2. search for

    • DocumentRoot "/Library/WebServer/Documents" and
    • <Directory "/Library/WebServer/Documents">

    and replace /Library/WebServer/Documents with the path you want Apache to serve for localhost, e.g., /Users/<username>/Projects

  3. restart Apache: sudo apachectl restart
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.