如何为Apache 2.4(OSX)安装模块? [英] How to install modules for Apache 2.4 (OSX)?

查看:76
本文介绍了如何为Apache 2.4(OSX)安装模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Homebrew安装了Apache.当我开始默认安装时,出现此错误:

I installed apache with Homebrew. When I start the default installation I get this error:

httpd:/usr/local/etc/httpd/httpd.conf的第85行的语法错误:无法将lib/httpd/modules/mod_auth_basic.so加载到服务器中:dlopen(/usr/local/var/www/lib/httpd/modules/mod_auth_basic.so,10):找不到图片

httpd: Syntax error on line 85 of /usr/local/etc/httpd/httpd.conf: Cannot load lib/httpd/modules/mod_auth_basic.so into server: dlopen(/usr/local/var/www/lib/httpd/modules/mod_auth_basic.so, 10): image not found

我经历了将未找到的模块注释掉的问题,但是似乎丢失了所有模块,尤其是像mod_auth_basic这样有用的模块.在查看使用自制软件安装apache的教程时,我注意到它在计算机上安装的路径与教程中的路径大不相同.

I went through commenting unfound modules out but it seems like it's missing all of them, especially useful ones like mod_auth_basic. Looking at tutorials for installing apache with homebrew, I've noticed the paths it installed to on my computer are vastly different than what they are in the tutorial.

如何安装这些模块(最好是采用多合一软件包,而不是一次安装一个)?

How do I install these modules (preferably with an all-in-one package as opposed to one at a time)?

查看错误消息一秒钟后,我意识到 dlopen()将ServerRoot用作模块的基础.代替

After looking at the error message for a second, I realized that the dlopen() is using my ServerRoot as the base for the modules. Instead of

dlopen(/usr/local/var/www/lib/httpd/modules/mod_auth_basic.so)

dlopen(/usr/local/var/www/lib/httpd/modules/mod_auth_basic.so)

应该是

dlopen(/usr/libexec/apache2/mod_auth_basic.so

dlopen(/usr/libexec/apache2/mod_auth_basic.so

那我该如何将模块加载器指向正确的目录?

So how do I point the module loader to the correct directory?

我解决了模块不加载的问题,但是我仍然很想知道如何添加模块.

I solved the issue with modules not loading, but I would still love to know how to add modules.

推荐答案

如果您的模块目录为/usr/libexec/apache2 ,则可能需要禁用SIP才能进行复制模块文件( *.so )在那里.以下讨论可能会有所帮助: https://apple.stackexchange.com/questions/193368/el-capitan-really中的无根特征到底是什么

If your module dir is /usr/libexec/apache2, then you may need to disable SIP in order to be able to copy module file (*.so) there. The following discussion may help: https://apple.stackexchange.com/questions/193368/what-is-the-rootless-feature-in-el-capitan-really

无论如何,如果您想通过httpd安装获得更大的自由度,则可能需要下载并构建源代码.这非常简单,您可以将其安装在不受保护的任何目录中(建议的默认值为/usr/local/apache2 很好),因此您无需经历任何麻烦禁用SIP.

Anyway, if you want more liberty with your httpd installation, you may want to download and build the source. It is quite simple and you can install it in any directory which is not protected (the suggested default is /usr/local/apache2 which is fine) so you don't need to go through the hassle of disabling SIP.

这篇关于如何为Apache 2.4(OSX)安装模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆