Tuesday, October 3, 2017

virtualhost - apache2 server no permission on new directory




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:




ServerName example.com


ServerAdmin webmaster@localhost
DocumentRoot /web/test

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


Answer



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:





Options Indexes FollowSymLinks
AllowOverride None


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...