duanji7182 2011-08-06 10:00
浏览 31
已采纳

MVC PHP应用程序的结构

I am currently developing a php application using MVC techniques. I started it without thinking about a useful directory structure.
I'm planning to deploy the application to a apache2 server now. This is how it looks right now.
My current layout

I have a httpdocs folder on the server which is accessible from the web. If I copy all files into this directory some files might be accessible that shouldn't. The public folder contains the files that have to be accessible. (I might need to put my index.php there)

My question is: What is the preferred layout for such an application? Should I put all folders except public in the parent folder of httpdocs?

Thanks for your advices!

  • 写回答

3条回答 默认 最新

  • douou8954 2011-08-06 10:12
    关注

    http://httpd.apache.org/docs/2.1/vhosts/examples.html

    You can have a look there. Setting up a virtual host is always nice so you don't mix your application. And you just give access to your public folder.

    <VirtualHost *:80>
    DocumentRoot /var/www/mvc_app/public
    ServerName www.example.com
    
    <Directory /var/www/mvc_app/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>
    
    </VirtualHost>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码