开发者

Symfony 1.4 under a userdir in Apache

I have users who want to run their own Symfony projects under their home directories, but I can't get Symfony to work properly. In my Apache2 config file, I set the userdir as:

UserDir sfproject/web

But the DocumentRoot has to be:

/var/www/sfproject/web

This requirement is there because when we deploy the code to production, we don't want to change the Apache config file. And everything is going to be under that directory.

The problem is that when we go to a user directory: dev.server.com/~asdf

Symfony gives a 404 error: Empty module and/or action after parsing the URL "/index.php" (/).

I don't understand what's wrong. We want them to see their individual projects in their home directories. I looked at some other people setting up Symfony in shared hosting environments, but this is not a shared hosting environment. This is a dedicated server and I have root. Thank you for your help. Here is the relevant parts of my Apache config:

UserDir sfproject/web 

<Directory "/usr/share/php/data/symfony/web/sf">开发者_运维问答
   AllowOverride All
   Allow from All
</Directory>

<VirtualHost *>
   DocumentRoot "/var/www/sfproject/web"
   DirectoryIndex index.php

<Directory "/var/www/sfproject/web">
   AllowOverride All
   Allow from All
</Directory>

  Alias /sf /usr/share/php/data/symfony/web/sf
  <Directory "/usr/data/symfony/web/sf">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>


I think something like the following would be closer to a solution.

<VirtualHost *>

  DocumentRoot "/var/www/sfproject/web"
  DirectoryIndex index.php

  <Directory "/var/www/sfproject/web">
    AllowOverride All
    Allow from All
  </Directory>

  # or is the dir /usr/share/php/data/symfony/data/web/sf  ?
  Alias /sf /usr/share/php/data/symfony/lib/vendor/symfony/data/web/sf
  <Directory "/usr/share/php/data/symfony/lib/vendor/symfony/data/web/sf">
    AllowOverride All
    Allow from All
  </Directory>

</VirtualHost>

The paths from your excerpt does not look good I guess. Try it out and let us know if it works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜