Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ondrej/nginx and brotli #185

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/fpm-nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ ARG UPSTREAM_CHANNEL=''
ARG PHP_VERSION='8.2'
ARG BASE_IMAGE="serversideup/php:${UPSTREAM_CHANNEL}${PHP_VERSION}-fpm"

FROM ${BASE_IMAGE} as repo-config

RUN apt-get update \
&& apt-get install -y --no-install-recommends gnupg2 ca-certificates software-properties-common \
&& add-apt-repository -y ppa:ondrej/nginx

FROM ${BASE_IMAGE}

LABEL maintainer="Jay Rogers (@jaydrogers)"
Expand All @@ -15,6 +21,9 @@ ENV MSMTP_RELAY_SERVER_HOSTNAME="mailhog" \
PHP_PM_MIN_SPARE_SERVERS="1" \
PHP_PM_MAX_SPARE_SERVERS="3" \
SSL_MODE="full"

COPY --from=repo-config /etc/apt/sources.list.d/ /etc/apt/sources.list.d/
COPY --from=repo-config /etc/apt/trusted.gpg.d/ondrej-ubuntu-nginx.gpg /etc/apt/trusted.gpg.d/ondrej-ubuntu-nginx.gpg

# install`nginx` (web server) & `msmtp` (smtp client)
RUN apt-get update \
Expand All @@ -41,4 +50,4 @@ COPY etc/php/fpm/pool.d/ /etc/php/current_version/fpm/pool.d/
EXPOSE 80
EXPOSE 443

ENTRYPOINT ["/init"]
ENTRYPOINT ["/init"]
6 changes: 4 additions & 2 deletions src/fpm-nginx/etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ user webuser webgroup;
worker_processes auto;
pid /run/nginx.pid;
daemon off;
load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;


events {
worker_connections 768;
Expand Down Expand Up @@ -44,8 +47,7 @@ http {
##
# Increase header size for better support on Laravel APIs
##
http2_max_field_size 16k;
http2_max_header_size 32k;
large_client_header_buffers 4 16k;

##
# Virtual Host Configs
Expand Down
11 changes: 10 additions & 1 deletion src/fpm-nginx/etc/nginx/server-opts.d/performance.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,13 @@ gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;

# brotli
brotli on;
brotli_comp_level 6;
application/atom+xml application/javascript application/json application/rss+xml
application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype
application/x-font-ttf application/x-javascript application/xhtml+xml application/xml
font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon
image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml;