Merge pull request #2696 from geraintdong/master

Add http2 support for Apache2
This commit is contained in:
Shao Yu-Lung (Allen) 2020-09-04 09:25:44 +08:00 committed by GitHub
commit ade6f6b1a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 COPY vhost.conf /etc/apache2/sites-enabled/vhost.conf
ARG APACHE_INSTALL_HTTP2=false
RUN mkdir /etc/apache2/ssl 2> /dev/null
RUN if [ ${APACHE_INSTALL_HTTP2} = true ]; then \
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"] ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"]
CMD ["supervisord"] CMD ["supervisord"]

View File

@ -390,6 +390,7 @@ services:
- PHP_UPSTREAM_PORT=${APACHE_PHP_UPSTREAM_PORT} - PHP_UPSTREAM_PORT=${APACHE_PHP_UPSTREAM_PORT}
- PHP_UPSTREAM_TIMEOUT=${APACHE_PHP_UPSTREAM_TIMEOUT} - PHP_UPSTREAM_TIMEOUT=${APACHE_PHP_UPSTREAM_TIMEOUT}
- DOCUMENT_ROOT=${APACHE_DOCUMENT_ROOT} - DOCUMENT_ROOT=${APACHE_DOCUMENT_ROOT}
- APACHE_INSTALL_HTTP2=${APACHE_INSTALL_HTTP2}
volumes: volumes:
- ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG} - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG}
- ${APACHE_HOST_LOG_PATH}:/var/log/apache2 - ${APACHE_HOST_LOG_PATH}:/var/log/apache2

View File

@ -304,6 +304,7 @@ APACHE_PHP_UPSTREAM_CONTAINER=php-fpm
APACHE_PHP_UPSTREAM_PORT=9000 APACHE_PHP_UPSTREAM_PORT=9000
APACHE_PHP_UPSTREAM_TIMEOUT=60 APACHE_PHP_UPSTREAM_TIMEOUT=60
APACHE_DOCUMENT_ROOT=/var/www/ APACHE_DOCUMENT_ROOT=/var/www/
APACHE_INSTALL_HTTP2=false
### MYSQL ################################################# ### MYSQL #################################################