如何在amazon linux ami上为httpd 2.4安装xsendfile?

Kei*_*ilo 2 x-sendfile amazon-web-services apache2.4

如何在amazon linux ami上为httpd 2.4安装xsendfile?来自amazon和epel的默认软件包存储库没有httpd 2.4的软件包,仅适用于httpd 2.2.如果可能的话,我宁愿不编译模块.谢谢.

Gab*_*iDi 5

在编写这个答案时,我不知道在EC2实例上为Apache24的X-sendfile快速安装Yum/apt-get样式,但是编译和安装模块你的自己非常容易:

Prepwork

下载链接下载 mod_xsendfile.c链接

https://tn123.org/mod_xsendfile/
Run Code Online (Sandbox Code Playgroud)

安装GCC进行编译

sudo yum install gcc
Run Code Online (Sandbox Code Playgroud)

我们需要httpd24-devel for apxs

sudo yum install httpd24-devel.x86_64
Run Code Online (Sandbox Code Playgroud)

编译和安装

sudo apxs -cia mod_xsendfile.c
Run Code Online (Sandbox Code Playgroud)

编辑你的http.conf添加

<IfModule mod_xsendfile.c>
  XSendFile on
  XSendFilePath /home/path/to/private/files/to/serve/
</IfModule>
Run Code Online (Sandbox Code Playgroud)

重启Apache24

sudo service httpd restart
Run Code Online (Sandbox Code Playgroud)

做完了!

检查你的phpinfo或apache_modules()以确认所有好的并根据自己的喜好修改设置.享受高效下载:)