forked from vikunja/website-old
Add better cache policies to docker image
This commit is contained in:
parent
954e9c52a4
commit
69498c1db5
@ -1,3 +1,3 @@
|
||||
FROM nginx
|
||||
ADD public /usr/share/nginx/html
|
||||
ADD nginx.conf /etc/nginx/conf.d/default.conf
|
||||
ADD nginx.conf /etc/nginx/nginx.conf
|
||||
|
75
nginx.conf
75
nginx.conf
@ -1,19 +1,70 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name vikunja.io;
|
||||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
charset utf-8;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
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 /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_min_length 256;
|
||||
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml font/woff2 image/x-icon;
|
||||
|
||||
# Expires map
|
||||
map $sent_http_content_type $expires {
|
||||
default off;
|
||||
text/html epoch; # We don't cache the html for the browser to get the content
|
||||
text/css max;
|
||||
application/javascript max;
|
||||
~image/ max;
|
||||
~font/ max;
|
||||
}
|
||||
|
||||
rewrite ^/en/(.*)$ https://$server_name/$1 redirect;
|
||||
server {
|
||||
listen 80;
|
||||
listen 81 default_server http2 proxy_protocol; ## Needed when behind HAProxy with SSL termination + HTTP/2 support
|
||||
|
||||
error_page 404 /404.html;
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
server_name vikunja.io;
|
||||
|
||||
expires $expires;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
rewrite ^/en/(.*)$ https://$server_name/$1 redirect;
|
||||
|
||||
error_page 404 /404.html;
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user