Symfony2 Vhost Configuration
5,712
Solution 1
Here an exemple for prod and dev vhosts
# Symfony 2 : monapp.dev
<virtualHost *:80>
ServerName monapp.dev
DocumentRoot /data/www/MonApp/web/
<Directory "/data/www/MonApp/web">
DirectoryIndex app_dev.php
Options -Indexes FollowSymLinks SymLinksifOwnerMatch
AllowOverride None
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app_dev.php [QSA,L]
</Directory>
</VirtualHost>
# Symfony 2 : monapp.prod
<VirtualHost *:80>
ServerName monapp.prod
DocumentRoot /data/www/MonApp/web/
<Directory "/data/www/MonApp/web">
DirectoryIndex app.php
Options -Indexes FollowSymLinks SymLinksifOwnerMatch
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
Solution 2
mod_rewrite was installed but not enabled. Silly me!!
Author by
Bendihossan
Recent Computer Science graduate and web developer in Cardiff, Wales, UK.
Updated on September 18, 2022Comments
-
Bendihossan over 1 year
I'm new to Symfony2 and following the EnsJobeet tutorial. My VirtualHost config is as follows:
<VirtualHost *:80> ServerName jobeet.local DocumentRoot /var/www/ensjobeet/web/ DirectoryIndex app.php ErrorLog /var/log/apache2/jobeet-error.log CustomLog /var/log/apache2/jobeet-access.log combined <Directory "/var/www/ensjobeet/web/"> AllowOverride All Allow from All </Directory> </VirtualHost>
When I make requests to jobeet.local/app_dev.php/job/ I get the jobs page, when I make requests to jobeet.local/app.php/job/ I get the jobs page. However requests to jobeet.local/job/ 404 with
The requested URL /job/ was not found on this server.
I would have thought that requests jobeet.local/ and jobeet.local/app.php/ would have been equivalent but they don't appear to be so is there some other aspect of the environment configuration I have wrong?