- commit
- 66a89cc62608a4a51a36186f362cf5ef168ed011
- parent
- f7ff264cfd63eb7ab5153fc852ae3e836faffe4d
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-04-04 06:12
add example nginx config
Diffstat
| M | Makefile | 1 | + |
| A | via.nginx | 30 | ++++++++++++++++++++++++++++++ |
2 files changed, 31 insertions, 0 deletions
diff --git a/Makefile b/Makefile
@@ -5,3 +5,4 @@ via: via.go 5 5 install: 6 6 install -D -m 755 via "${DESTDIR}/usr/bin/via" 7 7 install -D -m 644 via.service "${DESTDIR}/lib/systemd/system/via.service" -1 8 install -D -m 644 via.nginx "${DESTDIR}/etc/nginx/sites-available/via"
diff --git a/via.nginx b/via.nginx
@@ -0,0 +1,30 @@
-1 1 limit_req_zone $binary_remote_addr zone=via:1m rate=10r/s;
-1 2
-1 3 server {
-1 4 server_name _;
-1 5
-1 6 listen [::]:80;
-1 7 listen 80;
-1 8
-1 9 location / {
-1 10 # https://enable-cors.org/server_nginx.html
-1 11 add_header 'Access-Control-Allow-Origin' '*';
-1 12 add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
-1 13 add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
-1 14 add_header 'Link' '<https://github.com/xi/via>; rel="help"';
-1 15
-1 16 # https://www.nginx.com/blog/rate-limiting-nginx/
-1 17 limit_req zone=via burst=20 nodelay;
-1 18 # client_max_body_size 1m; # default is fine
-1 19
-1 20 if ($request_method = 'OPTIONS') {
-1 21 add_header 'Access-Control-Max-Age' 1728000;
-1 22 add_header 'Content-Type' 'text/plain; charset=utf-8';
-1 23 add_header 'Content-Length' 0;
-1 24 return 204;
-1 25 }
-1 26
-1 27 proxy_pass http://localhost:8001;
-1 28 proxy_buffering off;
-1 29 }
-1 30 }