2

I tried to add another folder to apache and I get the following error when trying to acces testing/index.html.

The idea is that I would like to have for every customer a folder like /home/neagoe/Work/InterWebs/Projects/[PROJECT NAME]/CustomerProjects/website/dist.

Forbidden

You don't have permission to access /index.html on this server. Apache/2.2.22 (Ubuntu) Server at testing Port 80

Here are the steps that I followed:

Step1:

sudo chmod a+x /home/neagoe/Work/InterWebs/Projects/testing/CustomerProjects/website/dist

Step2:

sudo chown -R www-data:www-data /home/neagoe/Work/InterWebs/Projects/testing/CustomerProjects/website/dist

sudo chmod -R 775 /home/neagoe/Work/InterWebs/Projects/testing/CustomerProjects/website/dist

Step3:

sudo adduser $USER www-data

Step4:

sudo a2enmod userdir

Step5:

sudo cp /etc/apache/sites-available/default /etc/apache/sites-available/testing

I edited the file /etc/apache/sites-available/testing so it looks like this:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName testing
    DocumentRoot /home/neagoe/Work/InterWebs/Projects/testing/CustomerProjects/website/dist

    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /home/neagoe/Work/InterWebs/Projects/testing/CustomerProjects/website/dist/ >
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Step6:

I edited hosts ("/etc/hosts") so it looks like this:

127.0.0.1       localhost 
127.0.0.1       testing


# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Step7:

sudo a2ensite testing
sudo service apache2 restart

I searched for about 2 hours on the internet but I can't figure out what went wrong. All the pages that I found following the same steps as described above.

I know there are similar questions here on AskUbuntu, but the answer is to change permision to the directory which I did on Step2.

I am sorry if this is really a duplicate but I could't find the right answer.

Thank you!

1 Answer 1

1

I had the same problem , I edit the /etc/apache2/apache2.conffile and add

<Directory /var/www/ >
   Order allow,deny
   Allow from all
   Require all granted
</Directory>

and reset the apache2

 sudo service apache2 restart 

work for me .

You must log in to answer this question.

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