且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在共享主机上部署 Symfony2?

更新时间:2023-02-26 22:14:20

在你的配置中,apache 使用 public_html 作为文档根

In your configuration, apache uses public_html as the document root

如果 Symfony2 安装在 /home/u105859802/public_html/amateur1 目录下,Symfony 公共目录是 /home/u105859802/public_html/amateur1/web/

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

你应该使用

RewriteBase /amateur1/web/

但要注意,它不安全
您必须保护您的 symfony 目录!(配置可访问)

为什么不尝试将 symfony 文件移动到您的私人区域?
您可以将 Symfony 网络目录重命名为 public_html

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

参见如何在文档说明书中做到这一点

所以,我的推荐结构如下所示:

So, my recommendation structure looks like below :

  • /home/u105859802/
    • 供应商
    • 源代码
    • 应用
    • public_html(symfony2 中默认为 web)
    • /home/u105859802/
      • vendor
      • src
      • app
      • bin
      • public_html (web by default in symfony2) <- the only public directory