使用动态模块支持编译ApacheWeb服务器
我刚刚在新安装的Ubuntu 10.04.2上编译了Apache2.2.17。这是一个学习练习,目的是发现编译某个东西时实际发生了什么,而不仅仅是使用apt-get,因此避免使用apt-get,而是自己编译该东西 我跑:使用动态模块支持编译ApacheWeb服务器,apache,apache-modules,Apache,Apache Modules,我刚刚在新安装的Ubuntu 10.04.2上编译了Apache2.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
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链接
提前谢谢。试试这个
sudo ./configure --prefix=/etc/apache --enable-so --enable-shared=max --enable-rewrite -enable-mods-shared="all ssl ldap cache proxy authn_alias mem_cache file_cache authnz_ldap charset_lite dav_lock disk_cache"
警告:---启用mods shared=all do
实际上并不是构建所有模块
--启用共享=最大值无效。我想你想用“most”
您不应该以root用户身份运行所有内容
/configure
和make
在没有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安装
有关配置选项的更多信息,请访问。。谢谢你们两位的帮助
我试了几次才成功。在模块正确编译之前,我不得不下载Apache早期版本的源代码,而不是生成.a和.la文件。不确定这是否是因为在配置/制作/安装过程中发生了某种缓存事件,我不知道,并且我以前(错误的)编译尝试的某些部分以某种方式被重新运行,或者可能与Apache的2.2.17版本有关-不确定。无论如何,它最终还是成功了。我遇到了同样的问题:试图编译Apache2.2.x,其中所有(可能)模块都编译为动态模块,而不是静态模块 尽管我使用了配置选项(--enable mods shared=“list,of,modules”),但模块被编译为静态的,而不是共享的。更糟糕的是,在尝试“httpd-M”或“apachectl configtest”时出现了一些错误,这些错误与“*.so”文件相关,即使它们列在刚刚安装的httpd.conf(gmake安装)中 我调查了FreeBSD端口系统,发现他们的端口确实创建了一个包含所有共享模块的apache2.2.x,正如我所希望的那样。我发现“配置”选项存在问题 为了解决这个问题,我完全按照端口进行了操作,在配置时,我首先使用configure中的许多“-disable MODULE”条目“禁用”了所有模块(很难找到完整的模块列表,但得到了它)。以下是我的工作示例:
"./configure"
"--enable-layout=FreeBSD"
"--with-perl=/usr/local/bin/perl5.12.4"
"--with-expat=/usr/local"
"--with-iconv=/usr/local"
"--with-pcre=/usr/local"
"--disable-authn-file"
"--disable-authn-default"
"--disable-authz-host"
"--disable-authz-groupfile"
"--disable-authz-user"
"--disable-authz-default"
"--disable-auth-basic"
"--disable-charset-lite"
"--disable-include"
"--disable-log-config"
"--disable-env"
"--disable-setenvif"
"--disable-mime"
"--disable-status"
"--disable-autoindex"
"--disable-asis"
"--disable-cgid"
"--disable-cgi"
"--disable-negotiation"
"--disable-dir"
"--disable-imagemap"
"--disable-actions"
"--disable-userdir"
"--disable-alias"
"--disable-filter"
"--disable-substitute"
"--disable-proxy"
"--disable-proxy-connect"
"--disable-proxy-ftp"
"--disable-proxy-http"
"--disable-proxy-ajp"
"--disable-proxy-balancer"
"--disable-proxy-scgi"
"--disable-reqtimeout"
"--enable-so"
"--enable-mods-shared=auth_basic auth_digest authn_file authn_dbm authn_anon authn_default authn_alias authz_host authz_groupfile authz_user authz_dbm authz_owner authz_default cache disk_cache file_cache dav dav_fs actions alias asis autoindex cern_meta cgi charset_lite deflate dir dumpio env expires headers imagemap include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias filter version reqtimeout ssl"
"--with-dbm=sdbm"
"--with-ssl=/usr"
"--disable-ipv6"
"--with-devrandom"
"--with-mpm=worker"
"--prefix=/usr/local"
"--mandir=/usr/local/man"
"--infodir=/usr/local/info/"
这样,所有apache2.2.x模块都是动态构建的,而不是静态构建的。
如果您忘记了“-disable XXX”它们,而只尝试“-enable XXX”甚至“-enable mods shared=XXX,YYY,ZZZ”,那么它将不起作用。在设置“-enable mods shared”配置选项之前,必须禁用它们