8

我最近将我的 mac-os 更新为 Mojave。我正在使用 Nginx,它正在我以前的操作系统上运行,但是在更新到 Mojave 之后,我无法启动我的 Nginx。所以我尝试再次安装它,首先它给了我c编译器错误,所以我下载了Xcode命令行工具,它就消失了。现在它给了我找不到 libxml2/libxslt 库。我尝试使用 brew 安装它,但仍然遇到相同的错误。我不确定出了什么问题。

我已经使用 brew install 下载了 libxml2 和 libxslt。

我的配置脚本。

./configure \
--prefix=/opt/nginx/$NGINX_NAME_VERSION \
--pid-path=/var/run/nginx.pid \
--conf-path=/etc/nginx/$NGINX_NAME_VERSION/conf/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--lock-path=/var/lock/nginx.lock \
--http-client-body-temp-path=/var/tmp/nginx/body \
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \
--http-proxy-temp-path=/var/tmp/nginx/proxy \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--with-debug \
--with-http_addition_module \
--with-http_dav_module \
--with-http_geoip_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_sub_module \
--with-http_xslt_module \
--with-mail \
--with-mail_ssl_module \
--with-cc-opt=-I/usr/local/opt/openssl/include \
--with-ld-opt=-L/usr/local/opt/openssl/lib \
--builddir=$NGINX_BUILD_PATH

错误 :

checking for OpenSSL library ... found
checking for zlib library ... found
checking for libxslt ... not found
checking for libxslt in /usr/local/ ... not found
checking for libxslt in /usr/pkg/ ... not found
checking for libxslt in /opt/local/ ... not found

你可以看到它能够找到 OpenSSL、zlib 但不能找到 libxslt。请有人帮我解决这个问题。

4

2 回答 2

13

尝试以下

sudo apt-get install libxslt-dev

您可能还需要

sudo apt-get install libgd-dev # for the "error: the HTTP image filter module requires the GD library." error
sudo apt-get install libgeoip-dev # for the GeoIP package
于 2019-09-18T09:41:16.407 回答
0

有时你知道你已经安装了libxslt,但 nginx 仍然不停地喊你没有。

后面的实际问题不在于是否libxslt已安装,而在于 nginx 能否成功链接到它。最后,我发现libxlst链接到icu安装在我的环境中的旧版本。然后我意识到我libxml2太老了。升级我的后libxml2,一切都恢复正常。

于 2021-03-04T14:15:37.303 回答