dphphvs496524 2015-06-30 12:43
浏览 19
已采纳

在共享主机上部署Symfony2

I can not find reply to my question. I am trying to understand how i should deploy symfony2 app on shared hosting. I know i should rename my "web" catalog to "public_html", but i have many sites in this catalog. My catalog's structure is like:

-public_html
  -www.firstsite.com
  -www.secondsite.com
  ...
  -www.nextsite.com
-private_html

So where i should put my files? app,src,vendor under public_html, and files from web i should put directly to "public_html"? Or catalog web should be in public_html and other files under public_html? So i will have:

-public_html
  -...
  -web
-private_html
-app
-src
-...

EDIT: Now i have whole app in "public_html/example/" It's work fine, but it is safe?

  • 写回答

2条回答 默认 最新

  • dongzou1964 2015-06-30 13:23
    关注

    You should create a folder for your new website inside "public_html". Let's say you have the domain "example.com".

    You will have: public_html/example.com, public_html/example2.com, ..

    Inside the folder example.com you will copy the folders: app, src, public.. (all Symfony's project main folders and files).

    To answer to your question. "EDIT: Now i have whole app in "public_html/example/" It's work fine, but it is safe?". Yes, it's safe.

    Just search on google for: "prevent directory traversal", if you want to make sure that it's secure.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
  • douba4933 2016-09-17 19:00
    关注

    Alternative solution could be installing/deploying Symfony in a folder outside "public_html", let's name it "symfony_app".

    Then, your directory structure could look something like this:

    -public_html
      -www.firstsite.com
      -www.secondsite.com
      ...
    -symfony_app
    

    And then, you should make a symlink of a Symfony "web" folder in the "public_html" folder.

    For example:

    ln -s /home/your_username/symfony_app/web /home/your_username/public_html/www.symfony-site.com
    

    ** folder named "www.symfony-site.com" must not exist in "public_html" before creating symlink!

    Last step would be adding new subdomain in cPanel. There you should connect your new subdomain with "www.symfony-site.com" symlink inside "public_html".

    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 最小生成树问题 Prim算法和Kruskal算法
  • ¥25 医院住院病人呼叫器设计
  • ¥15 不想和现在的团队合作了,怎么避免他们对程序动手脚
  • ¥30 c++类和数组实验代码
  • ¥20 C语言字符串不区分大小写字典排序相关问题
  • ¥15 关于#python#的问题:我希望通过逆向技术爬取1688搜索页下滑加载的数据
  • ¥15 关于Linux的终端里,模拟实现一个带口令保护的屏保程序遇到的输入输出的问题!(语言-c语言)
  • ¥30 请问,这个嵌入式Linux系统怎么分析,crc检验区域在哪
  • ¥15 二分类改为多分类问题
  • ¥15 Unity微信小游戏上调用ReadPixels()方法报错