apache - 使用动态模块支持编译 Apache Web 服务器

标签 apache apache-modules

我刚刚在全新安装的 Ubuntu 10.04.2 上编译了 Apache 2.2.17。这是一个学习练习,可以发现当你编译某些东西时实际发生了什么,而不是仅仅使用 apt-get,因此避免使用 apt-get 有利于自己编译东西。

我跑了:

sudo ./configure --prefix=/etc/apache --enable-module=so --enable-rule=SHARED_CORE --enable-shared=max --enable-ssl=shared --enable-rewrite=shared

紧随其后的是强制性的:

sudo make && sudo make install

一切似乎都很顺利(Apache 启动没有问题)除了在 Apache 模块目录中,我希望看到 mod_rewrite.so 和 mod_ssl.so,但我看到了:

#cd /etc/apache/modules
#ls -l
mod_rewrite.a
mod_rewrite.la
mod_ssl.a
mod_ssl.la

如何将它们转换为 .so 文件,以便我可以将它们与 Apache 配置中的 LoadModule 链接起来?

提前致谢。

最佳答案

您不应该以 root 身份运行所有内容。 ./configuremake 在没有 root 权限的情况下也能正常工作,make install 需要 root 权限才能写入目录,如 /etc/usr/bin

/etc 不适合可执行文件,更不用说完整的 Apache 安装了。如果您想将配置文件放在 /etc/apache 中,请使用 --sysconfdir=/etc/apache。安装定制 Apache 的正确位置是 /usr/local

要启用共享模块,你必须通过--enable-so选项,应该编译为共享的模块应该添加到--enable-mods-shared.

Apache + mod_ssl(共享模块)+ mod_rewrite(共享模块)的正确配置行是,安装在 /usr/local/apache 中,配置文件在 /etc/apache:

./configure --prefix=/usr/local/apache --sysconfdir=/etc/apache --enable-so \
  --enable-rewrite --enable-ssl --enable-mods-shared='rewrite ssl'

成功配置 Apache HTTPd 后,运行 make,然后运行 ​​sudo make install

关于配置选项的更多信息可以在 Apache HTTPd documentation 找到。 .

关于apache - 使用动态模块支持编译 Apache Web 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5259820/

相关文章:

c - 如何以 super 用户权限运行 Apache 模块?

linux - 访问 apache AWS EC2 Linux 服务器上的错误日志

mysql - Laravel AH01630 : client denied by server configuration on Specific API routes

linux - ec2 共享 www 文件夹

apache - 如何在 docker apache httpd 中安装 mod_pagespeed

Apache/使用 JSESSIONID 定义粘性

ftp - 如何在 MAMP 服务器上安装 mod_ftp 模块

sql - 如何查看hive变量的值?

apache - htaccess 漂亮的网址不起作用

wordpress - Apache mod-auth-mysql 与 phpass 加密密码 (Wordpress)