Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony app 403 Forbidden error: You don't have permission to access / on this server

Tags:

I'm trying to run a symfony app on a CentOS7 linode server, but I'm getting an error:

Cannot serve directory <path to project>: No matching DirectoryIndex (index.html, index.php) 

I have a vhost setup for this subdomain with this config:

<VirtualHost *:80>
     ServerAdmin [email protected]
     ServerName mister
     ServerAlias project.mystuff.com
     DocumentRoot /var/www/html/project
     ErrorLog /var/www/html/project/logs/error.log
     CustomLog /var/www/html/project/logs/access.log combined
     <Directory "/var/www/html/project" >
         #Options FollowSymLinks
         Options -Indexes
         AllowOverride All
         Require all granted
     </Directory>
</VirtualHost>

My current settings are:
1) My webserver user and group is apache
2) My permissions to the /var/www/html/project are 755 with apache:apache

I've tried the following suggestions on the internet to no avail:

1) Changed Options -Indexes to Options +Indexes
2) Added DirectoryIndex index.html
3) I get server errors if I change root ownership of /var

like image 677
Isaac Pak Avatar asked Jun 12 '16 23:06

Isaac Pak


1 Answers

I'm using CentOS 6 and Apache. Try this change:

<VirtualHost *:80>
     ServerAdmin [email protected]
     ServerName mister
     ServerAlias project.mystuff.com
     DocumentRoot /var/www/html/project/web
     ErrorLog /var/www/html/project/var/logs/error.log
     CustomLog /var/www/html/project/var/logs/access.log combined
     <Directory "/var/www/html/project/web" >
         Options Indexes FollowSymLinks MultiViews
         AllowOverride All
         Require all granted
     </Directory>
</VirtualHost>

Also verify you can use wget or curl to get your Symfony index.html page on the localhost. CentOS might have enabled SELinux or even iptables.

Use sestatus to see if it is set to enforcing - if so you need to allow web or disable SELinux temporarily.

xabbuh is correct. The "web" directory is the folder you need to use as your web root. If updated my post to reflect the changes needed.

like image 123
Alvin Bunk Avatar answered Oct 12 '22 22:10

Alvin Bunk