Verified Commit 9abbeb00 authored by tr's avatar tr
Browse files

Build nginx container

parent 14c8e475
...@@ -53,3 +53,36 @@ RUN cd /usr/local/src && \ ...@@ -53,3 +53,36 @@ RUN cd /usr/local/src && \
--add-dynamic-module=/usr/local/src/modsecurity-nginx-v$MODSECURITY_NGINX_VERSION && \ --add-dynamic-module=/usr/local/src/modsecurity-nginx-v$MODSECURITY_NGINX_VERSION && \
make modules && \ make modules && \
cp objs/ngx_http_modsecurity_module.so /usr/local/src/ cp objs/ngx_http_modsecurity_module.so /usr/local/src/
FROM centos:8
ENV MODSECURITY_VERSION 3.0.4
ENV MODSECURITY_NGINX_VERSION 1.0.1
RUN cd /usr/local/src && \
dnf install -y nginx && \
rm -rf /var/cache/* /var/log/*
# Copy modsecurity
COPY --from=builder /usr/local/modsecurity/bin/modsec-rules-check /usr/local/bin/
COPY --from=builder /usr/local/modsecurity/lib/libmodsecurity.so /usr/local/modsecurity/lib/
COPY --from=builder /usr/local/modsecurity/lib/libmodsecurity.so.3 /usr/local/modsecurity/lib/
COPY --from=builder /usr/local/modsecurity/lib/libmodsecurity.so.$MODSECURITY_VERSION /usr/local/modsecurity/lib/
# Copy modsecurity-nginx
COPY --from=builder /usr/local/src/ngx_http_modsecurity_module.so /usr/lib64/nginx/modules/
COPY nginx.conf /etc/nginx/
COPY modsecurity /etc/modsecurity
RUN mkdir -p /var/log/nginx && \
mkdir -p /etc/modsecurity/rules && \
ln -sf /dev/stdout /var/log/nginx/access.log && \
ln -sf /dev/stderr /var/log/nginx/error.log
VOLUME /etc/modsecurity/rules/
EXPOSE 80
STOPSIGNAL SIGQUIT
CMD ["nginx", "-g", "daemon off;"]
load_module "/usr/lib64/nginx/modules/ngx_http_modsecurity_module.so";
user nginx;
worker_processes auto;
worker_rlimit_nofile 1024;
pid /var/run/nginx.pid;
events {
accept_mutex on;
accept_mutex_delay 500ms;
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log crit;
sendfile on;
server_tokens off;
types_hash_max_size 1024;
types_hash_bucket_size 512;
server_names_hash_bucket_size 64;
server_names_hash_max_size 512;
keepalive_timeout 65s;
keepalive_requests 100;
client_body_timeout 60s;
send_timeout 60s;
lingering_timeout 5s;
tcp_nodelay on;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90s;
proxy_send_timeout 90s;
proxy_read_timeout 90s;
proxy_buffers 32 4k;
proxy_buffer_size 8k;
proxy_set_header Host $host;
proxy_headers_hash_bucket_size 64;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1d;
ssl_session_tickets off;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers on;
ssl_stapling on;
ssl_stapling_verify on;
include /etc/nginx/conf.d/*.conf;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment