apache设置自定义header
1、安装mod_headers.c模块# cd /usr/local/src/httpd-2.2.16/modules
# ls
aaa databaseexperimentalldap mappers README
arch dav filters loggers metadata ssl
cache debug generators Makefile NWGNUmakefiletest
config5.m4echo http Makefile.inproxy
# cd metadata/
# /usr/local/apache2/bin/apxs -i -a -c -n headers mod_headers.c
//用apxs工具添加模块
2、修改Apache配置文件
# vim /usr/local/apache2/conf/httpd.conf
<IFModule mod_headers.c>
Header add MyHeader "hello"
</IFModule>
3、测试
# curl -I 192.168.0.104/1.php
HTTP/1.1 200 OK
Date: Sat, 19 Apr 2014 02:45:13 GMT
Server: Apache/2.2.16 (Unix) PHP/5.3.27
X-Powered-By: PHP/5.3.27
MyHeader: hello //定义的header
Content-Type: text/html
页:
[1]