Add support for http2 for Apache2

This commit is contained in:
Lan Dong Si Hoang
2020-09-03 15:46:24 +07:00
parent 9d68a48c3e
commit 489075fc67
3 changed files with 15 additions and 0 deletions

View File

@ -19,6 +19,19 @@ WORKDIR /var/www/
COPY vhost.conf /etc/apache2/sites-enabled/vhost.conf
ARG APACHE_INSTALL_HTTP2=false
RUN if [ ${APACHE_INSTALL_HTTP2} = true ]; then \
mkdir /etc/apache2/ssl 2> /dev/null && \
&& openssl genrsa -out "/etc/apache2/ssl/ssl_site.key" 2048 \
&& openssl rand -out /root/.rnd -hex 256 \
&& openssl req -new -key "/etc/apache2/ssl/ssl_site.key" -out "/etc/apache2/ssl/ssl_site.csr" -subj "/CN=site.com/O=LGS/C=IT" \
&& openssl x509 -req -days 365 -in "/etc/apache2/ssl/ssl_site.csr" -signkey "/etc/apache2/ssl/ssl_site.key" -out "/etc/apache2/ssl/ssl_site.crt" \
&& a2enmod rewrite \
&& a2enmod headers \
&& a2enmod proxy proxy_html proxy_http xml2enc ssl http2 \
&& service apache2 restart \
;fi
ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"]
CMD ["supervisord"]