Saturday, January 29, 2011

403 with Apache and Symfony on Ubuntu 10.04

I'm trying to run symfony on my apache installation (I'm using xampp for the whole package) and it keeps giving me a 403 error every time I try to access my website.

I've got vhosts set up with the following:

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot "/opt/lampp/htdocs"
  DirectoryIndex index.php
  <Directory "/opt/lampp/htdocs">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName servername.localhost
    DocumentRoot /home/me/web/server/web
    DirectoryIndex index.php
    Alias /sf "/lib/vendor/symfony/data/bin/web/sf"

    <Directory "/home/me/web/server/web">
      AllowOverride All
      Allow from All
    </Directory>
</VirtualHost>

<Directory "/lib/vendor/symfony/data/bin/web/sf">
    Allow from All
</Directory>

I've also added "127.0.0.1 servername.localhost" in my hosts file.

When I try to access "servername.localhost" it just gives me a 403 error. I've chmod'd 777 the symfony directory and my website directory in my home directory and used './symfony project:permissions' to let symfony check that permissions are set up correctly but still not result.

If I move my website directory into "/opt/lampp/htdocs" then it will serve it from there but still has problems access the symfony stuff such as the debug toolbar.

Any help would be appreciated.

  • 403 is usually Directory Browsing Forbidden (checking Apache's error log should confirm this). Is there a default document (index.php) in your /home/me/web/server/web directory? You've aliased symphony into /sf, so you'd have to hit http://servername.localhost/sf to access it, not the top level http://servername.localhost/

    Dominic Santos : I have got an 'index.php' file in the '/home/me/web/server/web' folder; I also tried accessing 'servername.localhost/sf' but it gave me 404 error.
    Steve : The alias is just to symfony's web folder, it just contains some images and css for the symfony branded error pages- nothing integral; it's usually removed from everything bar development environments.
    Steve : Symfony has frontend web controllers, all urls should go through it (usually index.php) for dev there's also frontend_dev.php which provides more detailed errors.
    From Marc B
  • Symfony requires some rewrite rules, I don't see why the .htaccess wouldn't be present unless you've removed it- is mod_rewrite enabled?

    From Steve

0 comments:

Post a Comment