How to deploy Symfony2 on a shared-hosting?

后端 未结 2 730
广开言路
广开言路 2020-12-23 23:01

I want to access my symfony app in production env (http://www.sample.com/amateur1/web/app.php) from this url http://www.sample.com/amateur1.

To do that I moved the .

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-23 23:58

    In your configuration, apache uses public_html as the document root

    If Symfony2 is installed in directory /home/u105859802/public_html/amateur1, the Symfony public directory to serve is /home/u105859802/public_html/amateur1/web/

    You should use

    RewriteBase /amateur1/web/
    

    But beware, it is not safe
    You have to protect your symfony directories! (configuration is accessible)

    Why don't you try moving your symfony files in your private area ?
    You can rename the Symfony web directory to public_html

    See how to do that in documentation cookbook

    So, my recommendation structure looks like below :

    • /home/u105859802/
      • vendor
      • src
      • app
      • bin
      • public_html (web by default in symfony2) <- the only public directory

提交回复
热议问题