I am setting up an apache2 server on my server. I wanted to use another directory then /var/www. I created the directory /web

added my user to the www-data group

changed the owner/group and the permission:

chown -R root:www-data /web
chmod -R 755 /web

and then I created a new virtualhost with the right directory root enabled the site disabled the default one. Restarted the server.

But my server says: Forbidden you don't have permission.... I don't get why, I have already tried all possible tutorials of diverse forums and websites, but I can't get it working

My virtualhost config:

<VirtualHost *:80>
    ServerName example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /web/test

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
  • You need to show us your configuration to help you. – Khaled Jun 20 '17 at 9:44
  • Which configuration file exactly? Since I run it in Ubuntu I have multiple files – Apatus Jun 20 '17 at 9:46
  • Apache config (at least show us what you have changed)! – Khaled Jun 20 '17 at 9:46
  • Ubuntu has multiple files – Apatus Jun 20 '17 at 9:47
  • I now have edited my post – Apatus Jun 20 '17 at 11:48

Find your apache2.conf or the default apache configuration file depending on your linux distribution and make sure it has a directory configuration for your new web root. Something on the lines of:

<Directory /web/test/>
Options Indexes FollowSymLinks
AllowOverride None
  • Thank you that worked! I didn't knew that I have to specify the Directory! – Apatus Jun 20 '17 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.