Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using the built-in server on my Mac.

The URL to my Sites folder is: http://localhost/~username/

with MAMP I had just http://localhost/.

Is there any way to get just http://localhost/ with the built-in server?

I have only one user account on my Mac.

share|improve this question
add comment

4 Answers

up vote 3 down vote accepted

You want to change the "DocumentRoot" setting in the file /etc/apache2/httpd.conf, and restart web sharing.

share|improve this answer
add comment

I have also just changed DocumentRoot in /etc/apache2/httpd.conf. But another option is to use vhosts:

  1. Uncomment Include /private/etc/apache2/extra/httpd-vhosts.conf in /etc/apache2/httpd.conf
  2. Add this to /etc/apache2/users/username.conf or /etc/apache2/extra/httpd-vhosts.conf:

    <VirtualHost *:80>
        DocumentRoot "/Users/username/Sites"
        ServerName localhost
    </VirtualHost>
    
  3. sudo apachectl restart

If you get an error like You don't have permission to access / on this server, try adding this to /etc/apache2/users/username.conf:

<Directory "/Users/username/Sites/">
    Options Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
share|improve this answer
add comment

You need to put your site in /Library/WebServer (not sure about WebServer part but it should be similar) and make sure permissions are correct.

share|improve this answer
    
I want to have the files in the Sites folder, can I create an hardlink/symlink or something? –  Sindre Sorhus Sep 5 '09 at 17:13
    
Yes, you can. But do it in the Terminal, the Finder doesn't really create real hard/symlinks. –  christian studer Sep 16 '09 at 11:43
add comment

The best way to do this, which I've already done is this terminal command (first delete, rename or move the Documents folder out of /Library/WebServer): ln -s ~/Sites/ /Library/WebServer/Documents.

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.