现在的位置: 首页 > 综合 > 正文

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

2012年01月14日 ⁄ 综合 ⁄ 共 778字 ⁄ 字号 评论关闭
文章目录

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');

抱歉!评论已关闭.