In the end, I decided to overwrite the original nginx.conf.
FROM alpine:3.16
RUN apk --no-cache add nginx
COPY nginx.conf /etc/nginx/nginx.conf
COPY html /var/www/localhost/htdocs
EXPOSE 80
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]
# /etc/nginx/nginx.conf
user nginx;
# worker_processes auto;
worker_processes 1;
pcre_jit on;
error_log /dev/stderr warn;
events {
worker_connections 128;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;
client_max_body_size 1m;
sendfile on;
tcp_nopush on;
gzip_vary on;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /dev/stdout main;
server {
root /var/www/localhost/htdocs;
}
}
Comments