我目前正忙于有关Web服务器之间差异的单身项目。为了检测到这些,我试图建立一个Docker容器集合。目前,我已经从源头编译并运行了少数Nginx服务器。但是,与Apache相同似乎是一个挑战。除了Nginx dockerfiles,我根本没有编译经验。
我正在尝试使用OpenSSL 1.0.2从源代码编译Apache 2.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"]
在httpd目录中执行make
命令时遇到以下错误。
/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
,但这也行不通。
我们非常感谢您的帮助或提示!
答案 0 :(得分:0)
您正在构建自定义的OpenSSL版本,但没有将安装openssl(最可能是/ usr / local)的路径添加到LDFLAGS。我认为df['C'] = df['A'] / df['B']
应该解决您的问题