drcmue4619
2014-12-09 09:28
浏览 13
已采纳

如何在同一服务器上配置多个symfony2项目(dev环境)

I do not use a cache and still I get the same error in the dev enviroment.

I have three different projects that I want to run locally (dev pc Ubuntu) for development. Does anyone have a tip for me, how do I configure the vhosts or projects?

Thanks fralex

图片转代码服务由CSDN问答提供 功能建议

我不使用缓存,但仍然得到相同的错误在开发环境中。

我有三个不同的项目,我想在本地运行(dev pc Ubuntu)进行开发。 有没有人给我一个提示,如何配置虚拟主机或项目?

谢谢fralex

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongxilan9351 2014-12-09 10:01
    已采纳

    Here is an example of Symfony2's vhost for the lastest versions of Apache (set one for each of your sites):

    # /etc/apache2/sites-available/my-app.conf
    
    <VirtualHost *:80>
        ServerName my-app.local.fr
        DocumentRoot /home/me/Workspace/MySymfonyApp/web
    
        <Directory /home/me/Workspace/MySymfonyApp/web>
                Options Includes FollowSymlinks
                AllowOverride none
                Require all granted
                RewriteEngine On
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteRule ^(.*)$ app.php [QSA,L]
        </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/my_app_error.log
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/my_app_access.log vhost_combined
    </VirtualHost>
    

    Active it with the command:

    $ sudo a2ensite my-app
    

    And reload Apache's service:

    $ sudo service apache2 reload
    

    Do not forget to active url rewriting (you have to do this only once, not for all vhosts)!

    $ sudo a2enmod rewrite
    $ sudo service apache2 restart
    
    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题