home · contact · privacy
To microblog.pub NGINX setup, add gzip compression.
[config] / bullseye / etc_files / microblogpub / etc / nginx / sites-available / microblogpub.nginx
1 server {
2     listen 443 ssl;
3     client_max_body_size 4G;
4     server_name REPLACE_fqdn_ECALPER;
5     ssl_certificate /etc/letsencrypt/live/REPLACE_fqdn_ECALPER/fullchain.pem;
6     ssl_certificate_key /etc/letsencrypt/live/REPLACE_fqdn_ECALPER/privkey.pem;
7
8     // via <https://www.digitalocean.com/community/tutorials/how-to-improve-website-performance-using-gzip-and-nginx-on-ubuntu-20-04>
9     // and https://docs.microblog.pub/installing.html#nginx-config-tips
10     gzip on;
11     gzip_disable "msie6";
12     gzip_vary on;
13     gzip_proxied any;
14     gzip_comp_level 6;
15     gzip_buffers 16 8k;
16     gzip_http_version 1.1;
17     gzip_min_length 256;
18     gzip_types
19       application/atom+xml
20       application/geo+json
21       application/javascript
22       application/x-javascript
23       application/json
24       application/ld+json
25       application/manifest+json
26       application/rdf+xml
27       application/rss+xml
28       application/xhtml+xml
29       application/xml
30       font/eot
31       font/otf
32       font/ttf
33       image/svg+xml
34       text/css
35       text/javascript
36       text/plain
37       text/xml
38
39       text/html
40
41       application/javascript
42       application/activity+json
43       application/octet-stream;
44
45     location / {
46       proxy_set_header Host $http_host;
47       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
48       proxy_set_header X-Forwarded-Proto $scheme;
49       proxy_set_header Upgrade $http_upgrade;
50       proxy_set_header Connection $connection_upgrade;
51       proxy_redirect off;
52       proxy_buffering off;
53       proxy_pass http://localhost:8000;
54     }
55 }
56
57 map $http_upgrade $connection_upgrade {
58   default upgrade;
59   '' close;
60 }