I am trying to setup my apache2 virtualhost to run applications from an apps directory on my home directory.


Here are the steps there I am currently doing:

1) Creating the directories and adding an index.html file to it.


2) Granting Permissions to the directories.

sudo chown -R $USER:$USER /home/myusername/apps/application1

sudo chmod -R 755 /home/myusername/apps

3) Creating the virtual host file

sudo touch /etc/apache2/sites-enabled/application1.app.conf

<VirtualHost *:80>    
    ServerAdmin webmaster@localhost
    DocumentRoot /home/myusername/application1
    ServerName application1.app
    ServerAlias www.application1.app

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

4) Activate the host

sudo a2ensite application1.app

5) Restart Apache

sudo service apache2 restart

6) Adding the domain to the host file    application1.app

After doing all this, when I type the address on the browser application1.app I get the following 403.

You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at application1.app Port 80

Any ideas on what I am doing wrong? Thanks all.

1 Answer 1


When you use any non-standard directories with apache you need to also edit /etc/apache2/apache2.conf, and add in a <Directory /bla/bla> stanza so that apache knows it is OK to access the area. Just copy the existing /var/www or /var/www/html one. For example (from another question, and for a different location):

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted

<Directory /media/newhd/test_web/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
  • Yeah. That's right.. I figured out.. the instructions were on the apache2 landing page. Thanks tough. Voting up. ;) Commented May 2, 2015 at 6:36
  • 1
    There's a typo in the above answer, I tried to edit it but needs at least 6 characters to make an edit, and I don't have enough reputation to post a comment. /etc/apache2/apcahe2.conf should be /etc/apache2/apache2.conf
    – ATutorMe
    Commented Aug 3, 2015 at 1:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .