I am trying to create a local environment in Linux/Ubuntu.
I have install Apache 2.4.7 (using apt-get).
I have changed my /etc/hosts to this:
127.0.0.1 example.dev
127.0.0.1 localhost
...
I also added a file "example.dev.conf" to "/etc/apache2/sites-available" which looks like this:
<VirtualHost *:80>
ServerName example.dev
DocumentRoot "/home/yahya/path/to/projec"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/home/yahya/path/to/project">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
But when I go to example.dev I get the following message:
403 Forbidden! You don't have permission to access / on this server.
I also edited apache.conf part for <Directory />
from suggestions from this link: Forbidden You don't have permission to access / on this server and Error message "Forbidden You don't have permission to access / on this server"
from:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
to
<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Require all granted
</Directory>
I have used a2ensite. But still does not work.
Even if the solution is probably not that, you should check first that apache can access to you directory. This mean that your folder should have the read right to "others" or learn how to configure acls on linux.
$ ls -la /home/nek
# ...
drwxrwxr-x 6 nek nek 4096 nov. 19 21:07 MyFolderOfDev
The important part is the last part of permissions: "r-x". If you don't have something like that uses this command:
$ chmod -R 755 MyFolderOfDev
Your original configuration looks good to me. Checkout if you doesn't have a conflict with another vhost. But here is my configuration and it works pretty good:
# Defining virtualhost
<VirtualHost *:80>
# This is not needed but seriously recommended
ServerAdmin [email protected]
# This line is your host name (example.dev if you prefere)
ServerName nekland
# You can add another server name using ServerAlias
ServerAlias nekland.dev
# Path to your folder
DocumentRoot /home/nek/Apache/SymfonyProject/web/
# Here are options neeeded to authorizations and I added some classical options
<Directory /home/nek/Apache/SymfonyProject/web/>
AllowOverride All
Options -Indexes +FollowSymLinks +MultiViews
Require all granted
</Directory>
# For the error file, exactly like you did
ErrorLog /var/log/apache2/nekland.err
LogLevel warn
CustomLog /var/log/apache2/nekland.log combined
# A little bonus that remove the server signature from http requests
ServerSignature Off
</VirtualHost>
Of course do not forget to reload apache after each modification.
$ sudo service apache2 reload
And if nothing works... Check your logs ! That's the better way to find why your requests does work.