Apache Option FollowSymLinks

我终于意识到Apache “Option +FollowSymLinks”对我的重要性了。 以前对一些程序提供的.htaccess sample中Option +FollowSymLinks一条总是熟视无睹(比如,magento .htaccess就有这么一条),今天发现Option FollowSymLinks对我来说并非可有可无。因为我逐步摸索出的Magento一次安装,多处使用和WordPress一次安装,多处使用,都是借助于Linux软连接(symbol link)的强大功能。一旦使用Option -FollowSymLinks,我的一次安装多次使用的方案全部失灵了。

httpd.conf Can Override php.ini

httpd.conf and php.ini, which has priority? I have done some experiments, and the conclusions are – php settings in php.ini can be overrided by httpd.conf (or some other Apache configuration files) with php_admin_value, php_admin_flag, php_value, and php_flag. However, I find on Linux, if php_admin_value, php_admin_flag, php_value, or php_flag can not be put inside of VirtualHost… Continue reading httpd.conf Can Override php.ini

The First VirtualHost Is The Default

今天在apache上搞基础建设,为一个小小的问题排错排了很长时间,事后想想,不就是一个简单的VirtualHost默认值的问题嘛!排完以后我才想来,其实以前已经碰到过这个问题,在一个问题绊住两次脚,浪费了一天,真是不应该! 每个VirtualHost里有一个ServerName,还可以有零个及以上ServerAlias。假设一个 domain name example.com 的 ip address 是 201.202.203.204,  如果 example.com 在 .conf 文件里找不到同时匹配的 VirtualHost 和 ServerName (或ServerAlias),那么 example.com 将使用首个匹配的 VirtualHost (通常是 *:80 或 201.202.203.204:80)的设置。 我把apache VirtualHost的心得写下来,免得以后再绊脚。

NameVirtualHost has no VirtualHosts

这个问题不大。如果是我自己手写Apache conf文件,我一般不会用到NameVirtualHost。 我发现这个问题出现在Godaddy Server上,预装的是Godaddy自带的Simple Control Panel。Simple Control Panel会把Virtual Host信息保存在simplepanel.conf。如果通过Simple Control Panel重启Apache,不会看到任何症状;但如果在ssh下运行/etc/init.d/httpd restart,就会有若干个Warning “NameVirtualHost xxx.xxx.xxx.xxx:80 has no VirtualHosts”。 Simple Control Panel为每个配置的域名都添加一个ip-based NameVirtualHost directive,其实是不必要的,过多相同的NameVirtualHost就导致了Warning,删掉就可以了。