From 4a0d07d43a8acb99d0f3b03b79b0cb7bf8afcdda Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 21 Oct 2019 10:25:19 +0200 Subject: [PATCH] add nginx config --- README.md | 4 +-- nginx/ipfs.kretschmann.io.conf | 45 ++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 nginx/ipfs.kretschmann.io.conf diff --git a/README.md b/README.md index bf5abe2..22a51b6 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Build Status](https://flat.badgen.net/travis/kremalicious/ipfs?icon=travis)](https://travis-ci.com/kremalicious/ipfs) -This repo holds a simple React app built with [Next.js](https://nextjs.org) serving as the frontpage of [ipfs.kretschmann.io](https://ipfs.kretschmann.io) from where you can add files to IPFS via drag and drop. +This repo holds a React app built with [Next.js](https://nextjs.org) serving as the frontpage of [ipfs.kretschmann.io](https://ipfs.kretschmann.io) from where you can add files to IPFS via drag and drop. --- @@ -26,7 +26,7 @@ Will start a live-reloading local server, reachable under [localhost:3000](http: ## Production -To create a production build, run from the root of the project: +To create a production build: ```bash npm run build diff --git a/nginx/ipfs.kretschmann.io.conf b/nginx/ipfs.kretschmann.io.conf new file mode 100644 index 0000000..7b29f7f --- /dev/null +++ b/nginx/ipfs.kretschmann.io.conf @@ -0,0 +1,45 @@ +server { + server_name ipfs.kretschmann.io; # managed by Certbot + root /var/www/html; + index index.html index.htm index.nginx-debian.html; + + proxy_pass_header Server; + proxy_read_timeout 1800s; + + location ~ "^/(ipfs|ipns)(/|\$)" { + proxy_pass http://localhost:8080; + proxy_set_header Host $host; + proxy_set_header X-Ipfs-Gateway-Prefix ""; + proxy_cache_bypass $http_upgrade; + } + + location ~ "^/api/v0/(add|version|id)" { + proxy_pass http://localhost:5001; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } + + location / { + proxy_set_header host ipfs.kremalicious.now.sh; + proxy_ssl_server_name on; + proxy_pass https://alias.zeit.co; + } + + listen [::]:443 ssl ipv6only=on; # managed by Certbot + listen 443 ssl; # managed by Certbot + ssl_certificate /etc/letsencrypt/live/ipfs.kretschmann.io/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/ipfs.kretschmann.io/privkey.pem; # managed by Certbot + include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot +} + +server { + if ($host = ipfs.kretschmann.io) { + return 301 https://$host$request_uri; + } # managed by Certbot + + listen 80 ; + listen [::]:80 ; + server_name ipfs.kretschmann.io; + return 404; # managed by Certbot +}