PHP in the User Webspace (public_html) on Ubuntu

There are a few steps to enable the Apache UserDir module on an Ubuntu system, and allow users access to PHP processing for their web space.

  1. Begin by placing the UserDir module in the directory Apache checks for active modules. We don’t want to actually copy the files, we want symbolic links — it’s the Debian Way ®. sudo ln -s /etc/apache2/mods-available/userdir.load /etc/apache2/mods-enabled/userdir.load and the configuration file, sudo ln -s /etc/apache2/mods-available/userdir.conf /etc/apache2/mods-enabled/userdir.conf
  2. Next we need to enable PHP in the public_html area. Use your favorite text editor to modify /etc/apache2/mods-available/userdir.conf to remove the lines prohibiting GET POST Options. My userdir.conf is below:
    <IfModule mod_userdir.c>
            UserDir public_html
            UserDir disabled root
    
            <Directory /home/*/public_html>
                    AllowOverride FileInfo AuthConfig Limit Indexes
                    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
                    <Limit GET POST OPTIONS>
                            Order allow,deny
                            Allow from all
                    </Limit>
    #                <LimitExcept GET POST OPTIONS>
    #                        Order deny,allow
    #                        Deny from all
    #                </LimitExcept>
            </Directory>
    </IfModule>
  3. The last step it to restart the Apache service so that the changes are loaded, sudo ./etc/init.d/apache2 restart.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: