mirror of
https://github.com/docker/awesome-compose.git
synced 2025-04-26 02:38:07 +02:00
feature: nginx-wsgi-django-mysql
This commit is contained in:
parent
6531426a96
commit
9b0c979a1a
15 changed files with 488 additions and 0 deletions
24
nginx-wsgi-django-mysql/nginx/Dockerfile
Normal file
24
nginx-wsgi-django-mysql/nginx/Dockerfile
Normal file
|
@ -0,0 +1,24 @@
|
|||
FROM nginx:1.21.4-alpine
|
||||
|
||||
# Add nginx.conf to container
|
||||
COPY --chown=nginx:nginx nginx.conf /etc/nginx/nginx.conf
|
||||
COPY --chown=nginx:nginx default.conf /tmp/default.conf
|
||||
COPY --chown=nginx:nginx start.sh /app/start.sh
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Add bash for boot cmd &
|
||||
# permissions and nginx user for tightened security
|
||||
RUN apk add bash && \
|
||||
chown -R nginx:nginx /app && \
|
||||
chmod -R 755 /app && \
|
||||
chown -R nginx:nginx /var/cache/nginx && \
|
||||
chown -R nginx:nginx /var/log/nginx && \
|
||||
chmod -R 755 /var/log/nginx && \
|
||||
chown -R nginx:nginx /etc/nginx/conf.d && \
|
||||
touch /var/run/nginx.pid && \
|
||||
chown -R nginx:nginx /var/run/nginx.pid
|
||||
|
||||
USER nginx
|
||||
|
||||
CMD ["/app/start.sh"]
|
15
nginx-wsgi-django-mysql/nginx/default.conf
Normal file
15
nginx-wsgi-django-mysql/nginx/default.conf
Normal file
|
@ -0,0 +1,15 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name 0.0.0.0;
|
||||
|
||||
location / {
|
||||
proxy_pass http://$SERVER_ADDR;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_connect_timeout 300;
|
||||
proxy_send_timeout 300;
|
||||
proxy_read_timeout 300;
|
||||
send_timeout 300;
|
||||
}
|
||||
}
|
63
nginx-wsgi-django-mysql/nginx/nginx.conf
Normal file
63
nginx-wsgi-django-mysql/nginx/nginx.conf
Normal file
|
@ -0,0 +1,63 @@
|
|||
worker_processes auto;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Define the format of log messages.
|
||||
log_format main_ext '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for" '
|
||||
'"$host" sn="$server_name" '
|
||||
'rt=$request_time '
|
||||
'ua="$upstream_addr" us="$upstream_status" '
|
||||
'ut="$upstream_response_time" ul="$upstream_response_length" '
|
||||
'cs=$upstream_cache_status' ;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 1024;
|
||||
# Disable Display of NGINX Version
|
||||
server_tokens off;
|
||||
|
||||
##
|
||||
# Logging Settings
|
||||
##
|
||||
access_log /var/log/nginx/access.log main_ext;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
|
||||
##
|
||||
# Gzip Settings
|
||||
##
|
||||
gzip on;
|
||||
# gzip_vary on;
|
||||
# gzip_proxied any;
|
||||
# gzip_comp_level 6;
|
||||
# gzip_buffers 16 8k;
|
||||
# gzip_http_version 1.1;
|
||||
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
# Size Limits
|
||||
client_body_buffer_size 10K;
|
||||
client_header_buffer_size 1k;
|
||||
client_max_body_size 10m;
|
||||
large_client_header_buffers 4 8k;
|
||||
|
||||
##
|
||||
# SSL Settings
|
||||
##
|
||||
# ssl_protocols TLSv1.2 TLSv1.3;
|
||||
# ssl_session_timeout 15m;
|
||||
# ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
|
||||
# ssl_prefer_server_ciphers on;
|
||||
# ssl_session_tickets off;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
3
nginx-wsgi-django-mysql/nginx/start.sh
Normal file
3
nginx-wsgi-django-mysql/nginx/start.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
envsubst '$SERVER_ADDR' < /tmp/default.conf > /etc/nginx/conf.d/default.conf \
|
||||
&& nginx -g 'daemon off;'
|
Loading…
Add table
Add a link
Reference in a new issue