httpd.conf的设置(Symfony)
Symfony显示‘简短漂亮的(smart)’路径时用到了 mod_rewrite 模块。如果你的Apache版本没有将 mod_rewrite 模块编译进去,那么需要在 httpd.conf 中检查模块mod_rewrite是否是动态模块方式(DSO)安装的,并且确认是否已经打开(译者注:关于Apache的mod_rewrite模块安装和使用方法请参考Apache相关文档,这里假设读者已经具备这方面知识而不作过多说明):
AddModule mod_rewrite.c
LoadModule rewrite_module modules/mod_rewrite.so
在 httpd.conf 配置文件中加入一个新的虚拟主机
>Directory "C:/php5/pear/data/symfony/web/sf"<
AllowOverride All
Allow from All
>/Directory<
>VirtualHost *:80<
ServerName myfp
DocumentRoot "D:/httpServer"
DirectoryIndex index.php
Alias /sf "C:/php5/pear/data/symfony/web/sf"
>Directory "D:/httpServer"<
AllowOverride All
Allow from All
>/Directory<
>/VirtualHost<
>Directory "/$data_dir/symfony/web/sf"<
AllowOverride All
Allow from All
>/Directory<
>VirtualHost *:80<
ServerName myapp.example.com
DocumentRoot "/home/steve/myproject/web"
DirectoryIndex index.php
Alias /sf /$data_dir/symfony/web/sf
>Directory "/home/steve/myproject/web"<
AllowOverride All
Allow from All
>/Directory<
>/VirtualHost<
注意:上面的配置中的 $data_dir 变量需要替换成你的PEAR库目录。例如:在*nix系统中,你可以输入:
Alias /sf /usr/local/lib/php/data/symfony/web/sf
【作者: Liberal】【访问统计:】【2007年08月11日 星期六 17:59】【注册】【打印】
本文介绍如何为Symfony项目配置Apache服务器的httpd.conf文件,包括启用mod_rewrite模块及设置虚拟主机来支持Symfony应用的路径重写。
878

被折叠的 条评论
为什么被折叠?



