Wednesday, 20 July 2016

thumbnail

How-to-enable-userdir-in-Ubuntu-14.04-on-Amazon-EC2

Introduction

In this tutorial I will show you how to enable userdir and php mode in Ubuntu-14.04 on amazon instance.

This tutorial assumes you have successfully installed LAMP in your server.

1. To enable userdir do the following :-

sudo a2enmod userdir

2. Now configure apache module userdir :-

sudo vim /etc/apache2/mods-enabled/userdir.conf

First you should do the following backup conf file like below :-

sudo cp /etc/apache2/mods-enabled/userdir.conf /etc/apache2/mods-enabled/userdir.conf.old

Now replace the code as like below :-

<IfModule mod_userdir.c>
        UserDir public_html
        UserDir disabled root

        <Directory /home/*/public_html>
                AllowOverride All
                Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
                <Limit GET POST OPTIONS>
                        Require all granted
                        Order allow,deny
                        Allow from all
                </Limit>
                <LimitExcept GET POST OPTIONS>
#                       Require all denied
                        Order allow,deny
                        Allow from all
                </LimitExcept>
        </Directory>
</IfModule>



With the above setting you are ready to serve HTML files from public_html directory but If you have PHP files then you need to enable php mod. By default it is disabled.

sudo nano /etc/apache2/mods-available/php5.conf

Next we need to comment out from here <IfModule mod_userdir> till </IfModule>


3. Lastly we have to restart the Apache2 service :-

sudo service apache2 restart

4. Access it from the  browser like below :-

http://192.168.1.10/~username/

Remember that you have to put your content inside public_html directory. And create public_html directory inside user's home directory.

mkdir /home/username/public_html
chown -R username:www-data /home/sarfaraz/public_html

5.  Change the permission like below :-

sudo chmod -R 770 /home/username/public_html

That's it 
Please do Comments,Likes and Share

Related Posts :

Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments