Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • To setup custom webroot for Apache in Maverick

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 895
    Comment on it

    Apache by default serves files from the Document root i.e.

    /Library/WebServer/Documents/

    But what if you want your custom folder to serve webfiles. This tutorial walks you through the complete process.

    Create a new folder at the root level of your account and name it 'www' for example. Now this folder we want to use as the web-serving directory for our account.

    Launch Terminal found at Applications/Utilities/ and execute the following commands

    cd /etc/apache2/users
    To change to the user directory

    To find your username execute the following in the terminal

    whoami 
    

    For using nano to create a new file by the name of 'username.conf' where username is what is shown by the above command

    sudo nano username.conf

    Now add the below mentioned code to the newly created 'username.conf' file

    <Directory "/Users/username/www/">
    Options Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
    

    Change permissions of the file by

    sudo chmod 644 username.conf
    

    To reflect the changes restart apache by

    sudo apachectl restart
    

    Now to view files from the custom webroot either go to

    http://localhost/~username/

    or

    http://127.0.0.1/~username/

    depending on your configuration.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: