您的位置:首页 > 运维架构 > Apache

Apache 服务器安装和配置相关资料

2012-06-27 18:01 489 查看

1. 在windows上安装Apache服务

可以在同一台windows服务器上安装多个apache服务器,只要保证端口不重复就可以了

httpd.exe -k install

httpd.exe -k install n "你的服务名称"

httpd.exe -k install n "你的服务名称" -f "D:/httpd.conf"

2. 卸载windows上的Apache服务

httpd.exe -k uninstall

httpd.exe -k uninstall -n "要卸载的服务名称"

3. 在Linux上编译Apache的模块

例如编译:mod_xsendfile模块,使用如下命令

/usr/local/apache/bin/apxs -cia
 mod_xsendfile.c

编译后,重启Apache服务即可

4. mod_xsendfile模块的配置和使用

1).Apache 中的配置:

LoadModule xsendfile_module modules/mod_xsendfile.so

<IfModule xsendfile_module>
<Directory "/var/www/html/myweb/">
XSendFile On
XSendFilePath /var/data/files/
</Directory>
</IfModule>

2).PHP程序:

$file = '/var/data/files/1.zip';
if (!file_exists($file)) {
die("File '$file' doesn't exist.");
}

header("Content-Type:application/octet-stream");
header("X-Sendfile:$file");
header('Content-Disposition:attachment;filename=1.zip');
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: