feudal.conf 1.58 KB
Newer Older
Lukas Burgey's avatar
Lukas Burgey committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73

map $http_upgrade $connection_upgrade {
	default upgrade;
	'' close;
}

upstream django {
	server unix://home/feudal/backend/feudal.sock;
}

upstream websocket {
	server 127.0.0.1:15674;
}

server {
	listen 80 default_server;
	listen [::]:80 default_server;
	server_name _;
	return 301 https://$host$request_uri;
}

server {
	listen 443 ssl http2 default_server;
	listen [::]:443 ssl http2 default_server;

	server_name hdf-portal.data.kit.edu;
	charset	utf-8;
	client_max_body_size 75M;

	ssl on;
	ssl_certificate 	/etc/ssl/hdf-portal.data.kit.edu/chain.pem;
	ssl_trusted_certificate /etc/ssl/hdf-portal.data.kit.edu/fullchain.pem;
	ssl_certificate_key 	/etc/ssl/hdf-portal.data.kit.edu/key.pem;
	ssl_session_cache shared:SSL:20m;
	ssl_session_timeout 180m;
	ssl_prefer_server_ciphers on;
	ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DHE+AES128:!ADH:!AECDH:!MD5;
	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	ssl_dhparam /etc/nginx/cert/dhparam.pem;
	ssl_stapling on;
	ssl_stapling_verify on;
	resolver 141.3.175.65 141.3.175.66;

	add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

	root /home/feudal/webpage/dist;
	index index.html;
	
	location /backend/static {
		alias /home/feudal/backend/static;
	}	

	location /backend {
		uwsgi_pass django;
		include /home/feudal/backend/deployment/uwsgi_params;
	}

	location /frontend {
		try_files $uri  $uri/ /index.html;
	}

	location /ws {
		proxy_pass http://websocket/ws;
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection $connection_upgrade;
	}

	location / {
		rewrite "^$" /frontend;
	}
}