server {
	listen 443 ssl;
	listen [::]:443 ssl;
	server_name www.netoik.io;
	root /var/www/netoik-home/;

	# Configure secure access.
	ssl_certificate /etc/letsencrypt/live/netoik.io/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/netoik.io/privkey.pem;
	include /etc/letsencrypt/options-ssl-nginx.conf;
	ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
	add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

	# Forbide access to hidden files.
	location ~ /\. {
		return 404;
	}

	# Forward api requests to back service.
	location /api/ {
		proxy_pass http://127.0.0.1:8080;
	}
}

server {
	listen 80;
	listen [::]:80;
	server_name www.netoik.io;

	# Redirect to https.
	return 301 https://$host$request_uri;
}
