私は現在、Webサーバー間の違いに関する学士号プロジェクトで忙しいです。それらを検出するために、Dockerコンテナーのコレクションをセットアップしようとしています。現在、私はすでに少数のNginxサーバーをソースからコンパイルして実行しています。ただし、Apacheでも同じことが難しいようです。Nginx dockerfilesを除いて、コンパイルの経験はまったくありません。
OpenSSL1.0.2を使用してソースからApache2.4.20をコンパイルしようとしています。
次のdockerfileを試しました(異なるOpenSSLバージョンのApache 2.4.39で機能しました)。
FROM debian
# Install build requirements (or grab from docker cache)
RUN apt-get update && apt-get install wget git subversion make \
libpcre3-dev \
libpcre++-dev \
libxml2-dev \
libexpat1-dev \
python \
autoconf \
libtool-bin \
libpcre3-dev -y && \
git clone https://github.com/apache/httpd.git
ENV OPENSSL_VERSION=1.0.2
ARG OPENSSL_VERSION
ENV APACHE_VERSION=2.4.20
ARG APACHE_VERSION
# Install APACHE
# RUN wget https://archive.apache.org/dist/httpd/httpd-${APACHE_VERSION}.tar.gz && \
# tar zxf httpd-${APACHE_VERSION}.tar.gz && \
RUN wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz && tar xzvf openssl-${OPENSSL_VERSION}.tar.gz && \
cd openssl-${OPENSSL_VERSION} && ./Configure linux-x86_64 shared -fpic && make && make install && \
rm -rf /*.tar.gz
RUN cd /httpd && git checkout tags/${APACHE_VERSION} && svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr && ./buildconf
RUN cd httpd && ./configure \
--enable-dav \
--enable-so \
--enable-maintainer-mode \
--prefix=/usr/local/apache2 \
--with-mpm=worker \
--enable-layout=Apache \
--enable-mods-shared=most \
--with-included-apr \
--enable-static-support \
--enable-ssl=static \
--with-ssl=../openssl-${OPENSSL_VERSION} && \
make && \
make install
# Remove build dependencies
RUN apt-get remove wget git subversion make \
libpcre3-dev \
libpcre++-dev \
libxml2-dev \
python \
autoconf \
libtool-bin \
libpcre3-dev -y && \
apt-get autoremove -y && \
rm -rf /httpd
# Copy SSL certs and configs
RUN mkdir -p /usr/local/apache2/ssl && rm -f /usr/local/apache2/conf/httpd.conf && rm -f /usr/local/apache2/conf/extra/httpd-ssl.conf
COPY ./shared/apache/apache.crt /usr/local/apache2/ssl/apache.crt
COPY ./shared/apache/apache.key /usr/local/apache2/ssl/apache.key
COPY ./shared/apache/conf/httpd.conf /usr/local/apache2/conf/httpd.conf
COPY ./shared/apache/conf/extra/httpd-ssl.conf /usr/local/apache2/conf/extra/httpd-ssl.conf
EXPOSE 80
EXPOSE 443
CMD ["./usr/local/apache2/bin/httpd","-DFOREGROUND"]
make
httpdディレクトリでコマンドを実行すると次のエラーが発生します。
/httpd/srclib/apr/libtool --silent --mode=link gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -pthread -Wpointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wformat -Wformat-security -Werror=format-security -L/openssl-1.0.2/lib -lssl -lcrypto -lcrypt -lrt -lpthread -ldl -lexpat \
-o ab -static ab.lo /httpd/srclib/apr/libapr-2.la -lcrypt -lrt -lcrypt -lpthread -ldl -lexpat -lm
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
Makefile:73: recipe for target 'ab' failed
make[2]: Leaving directory '/httpd/support'
make[2]: *** [ab] Error 1
古いバージョンと新しいopensslバージョンを試しましたが、それは問題ではありませんでした。新しいバージョンでは、コンパイルプロセスの早い段階で、非推奨の警告(コンパイラによってエラーとしてスローされる)がスローされました。古いバージョンでは、メソッドの欠落について同じエラーが発生しました。
またlibssl-dev
、別のスレッドで提案されているようにインストールしようとしましたが、これも機能しませんでした。
ヘルプやヒントは大歓迎です!
カスタムOpenSSLバージョンを構築していますが、opensslをインストールするパス(ほとんどの場合/ usr / local)をLDFLAGSに追加していません。私は--with-ssl=/usr/local
あなたの問題を解決する必要があると思います
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加