配置virtualhost root

时间:2014-07-11 08:30:05

标签: php apache symfony configuration virtualhost

我需要配置我的虚拟主机,我在/ home / sfproduction / www / prod / public /中安装了symfony 我需要更改我的root才能指向我的文件夹/ p​​ublic /

我检查过symfony doc,但我不明白。 我该怎么办?

我当前的虚拟主机设置是这样但它不起作用(显示Bad Gateway):

----(我已经把.after<以便在论坛上展示)---

<./VirtualHost *:80>

  ServerName sfproduction.alwaysdata.net

  DocumentRoot "/home/sfproduction/www/prod/public/web"

  DirectoryIndex index.php

Alias /  /home/sfproduction/www/prod/public/

  <Directory /sfproduction/www/prod/public>

   AllowOverride All

   Allow from All

  </Directory>

<*/VirtualHost>

1 个答案:

答案 0 :(得分:0)

参考食谱:http://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html

<VirtualHost *:80>
  ServerName sfproduction.alwaysdata.net

  DocumentRoot /home/sfproduction/www/prod/public/web        
  <Directory /home/sfproduction/www/prod/public/web>
      AllowOverride All
      Order allow,deny
      Allow from All
  </Directory>
</VirtualHost>

评论后更新:

最初的问题是已解决,事实上现在你的网址指向你的symfony app.php

现在你的php分页已经下载了。 这个问题可能是由于Apache的配置错误造成的;

查看相关问题,了解如何解决:
PHP files are downloaded by browser instead of processed by local dev server (MAMP)

https://serverfault.com/questions/215455/what-causes-php-pages-to-consistently-download-instead-of-running-normally