Progress
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
FROM nginx:alpine
|
||||
|
||||
RUN apk add --no-cache gettext
|
||||
|
||||
COPY nginx/nginx.conf.template /etc/nginx/nginx.conf.template
|
||||
COPY nginx/start.sh /start.sh
|
||||
COPY devplacepy/static /app/static
|
||||
|
||||
RUN chmod +x /start.sh
|
||||
|
||||
CMD ["/start.sh"]
|
||||
@@ -0,0 +1,55 @@
|
||||
upstream app {
|
||||
server app:10500;
|
||||
}
|
||||
|
||||
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=app_cache:10m max_size=${NGINX_CACHE_MAX_SIZE:-1g} inactive=60m use_temp_path=off;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
client_max_body_size 20M;
|
||||
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-Frame-Options DENY;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header Referrer-Policy strict-origin-when-cross-origin;
|
||||
|
||||
gzip on;
|
||||
gzip_types text/plain text/css text/javascript application/javascript application/json image/svg+xml;
|
||||
gzip_min_length 1000;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
|
||||
location /static/ {
|
||||
alias /app/static/;
|
||||
expires 7d;
|
||||
add_header Cache-Control "public, immutable, max-age=604800";
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
location /avatar/ {
|
||||
proxy_pass http://app;
|
||||
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_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://app;
|
||||
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_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
proxy_connect_timeout 30s;
|
||||
proxy_read_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
|
||||
${NGINX_CACHE_CONFIG}
|
||||
}
|
||||
}
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
if [ "${NGINX_CACHE_ENABLED:-false}" = "true" ]; then
|
||||
NGINX_CACHE_CONFIG=' proxy_cache app_cache;
|
||||
proxy_cache_bypass $http_cache_control;
|
||||
proxy_cache_valid 200 1m;
|
||||
proxy_cache_use_stale error timeout updating;
|
||||
proxy_cache_lock on;
|
||||
add_header X-Cache-Status $upstream_cache_status;'
|
||||
fi
|
||||
|
||||
export NGINX_CACHE_CONFIG
|
||||
export NGINX_CACHE_MAX_SIZE="${NGINX_CACHE_MAX_SIZE:-1g}"
|
||||
|
||||
envsubst '${NGINX_CACHE_CONFIG} ${NGINX_CACHE_MAX_SIZE}' \
|
||||
< /etc/nginx/nginx.conf.template \
|
||||
> /etc/nginx/nginx.conf
|
||||
|
||||
exec nginx -g 'daemon off;'
|
||||
Reference in New Issue
Block a user