编译支持动态模块的Apache web服务器
我刚刚在Ubuntu 10.04.2的新安装版上编译了Apache 2.2.17。这是一个学习练习,可以在编译某些东西时发现实际发生的情况,而不仅仅是使用apt-get,因此避免使用apt-get来自己编译。编译支持动态模块的Apache web服务器
我跑:
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
我怎么可以T将这些文件放到.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"
警告:--enable-MODS共享=一切并没有 实际构建所有模块。
--enable-shared = max无效。我想你想用“最”?
您不应该以root身份运行所有内容。 ./configure
和make
可以在没有根权限的情况下正常工作,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的早期版本的源代码,然后才能正确编译模块,而不是生成。a和.la文件。不确定是否因为在配置/制作/安装过程中发生了某种缓存事情,我不知道这些缓存事件,并且我以前(不正确)编译尝试的某些部分正在以某种方式重新运行或可能这与2.2.17版本的Apache有关 - 不确定。无论如何,它最终奏效了。
我遇到了同样的问题:试图编译apache 2.2.x所有(可能)模块编译为动态模块而不是静态的。
尽管我已经使用了配置选项(--enable-mods-shared =“list,of modules”),但模块被编译为静态而不是共享。更糟糕的是,在尝试与“* .so”文件相关的“httpd -M”或“apachectl configtest”文件时,即使它们在刚刚安装的httpd.conf(gmake install)中列出,也会出现一些错误。
我调查了FreeBSD ports系统,发现他们的端口确实创建了一个带有所有共享模块的apache2.2.x,就像我想的那样。我发现这是“配置”选项的问题。
为了解决这个问题,我完成了与端口一样的配置,我在配置中首先“禁用”了所有模块(很难找到它们的完整列表但很难找到它),在配置中有许多“--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”配置选项之前,必须禁用它们。