]> cat aescling's git repositories - mastodon.git/blob - nanobox/nginx-web.conf.erb
New Crowdin translations (#11799)
[mastodon.git] / nanobox / nginx-web.conf.erb
1 worker_processes 1;
2 daemon off;
3
4 events {
5 worker_connections 1024;
6 }
7
8 http {
9 include /data/etc/nginx/mime.types;
10 sendfile on;
11
12 gzip on;
13 gzip_disable "MSIE [1-6]\.";
14 gzip_vary on;
15 gzip_proxied any;
16 gzip_comp_level 6;
17 gzip_buffers 16 8k;
18 gzip_min_length 500;
19 gzip_http_version 1.1;
20 gzip_types text/plain text/xml text/javascript text/css text/comma-separated-values application/xml+rss application/xml application/x-javascript application/json application/javascript application/atom+xml;
21
22 # Proxy upstream to the puma process
23 upstream rails {
24 server 127.0.0.1:3000;
25 }
26
27 map $http_upgrade $connection_upgrade {
28 default upgrade;
29 '' close;
30 }
31
32 # Configuration for Nginx
33 server {
34 # Listen on port 8080
35 listen 8080;
36
37 keepalive_timeout 70;
38 client_max_body_size 80M;
39
40 root /app/public;
41
42 add_header Strict-Transport-Security "max-age=31536000";
43
44 location / {
45 try_files $uri @rails;
46 }
47
48 location /sw.js {
49 add_header Cache-Control "public, max-age=0";
50 add_header Strict-Transport-Security "max-age=31536000";
51 try_files $uri @rails;
52 }
53
54 location ~ ^/(emoji|packs|system/media_attachments/files|system/accounts/avatars) {
55 add_header Cache-Control "public, max-age=31536000, immutable";
56 add_header Strict-Transport-Security "max-age=31536000";
57 try_files $uri @rails;
58 }
59
60 # Proxy connections to rails
61 location @rails {
62 proxy_set_header Host $host;
63 proxy_set_header X-Real-IP $remote_addr;
64 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
65 proxy_set_header X-Forwarded-Proto https;
66 proxy_set_header Proxy "";
67 proxy_pass_header Server;
68
69 proxy_pass http://rails;
70 proxy_buffering on;
71 proxy_redirect off;
72 proxy_http_version 1.1;
73 proxy_set_header Upgrade $http_upgrade;
74 proxy_set_header Connection $connection_upgrade;
75
76 proxy_cache CACHE;
77 proxy_cache_valid 200 7d;
78 proxy_cache_valid 410 24h;
79 proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
80 add_header Strict-Transport-Security "max-age=31536000";
81 add_header X-Cached $upstream_cache_status;
82
83 tcp_nodelay on;
84 }
85 }
86
87 proxy_cache_path /data/var/cache/nginx levels=1:2 keys_zone=CACHE:10m inactive=7d max_size=1g;
88
89 error_page 500 501 502 503 504 /500.html;
90 }
This page took 0.08772 seconds and 4 git commands to generate.