# Upstream component nginx needs to connect to.
upstream django {
    server unix:///opt/h0v1n8-website-env/website/website.sock; # For production file socket
    #server 127.0.0.1:8001; # Web port socket for use with uwsgi-hello-world-test.py
}

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

# Configuration of the server
server {
    # the port your site will be served on
    listen      443 ssl;
    # the domain name it will serve for
    server_name h0v1n8.nl www.h0v1n8.nl; # substitute your machine's IP address or FQDN
    ssl_certificate /etc/letsencrypt/live/h0v1n8.nl/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/h0v1n8.nl/privkey.pem;
    charset     utf-8;

    # max upload size
    client_max_body_size 75M;   # adjust to taste

    # Django media
    #location /media  {
    #    alias /path/to/your/mysite/media;  # your Django project's media files - amend as required
    #}

    location /static {
        alias /srv/www/static; # your Django project's static files - amend as required
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include     /opt/h0v1n8-website-env/uwsgi_params; # the uwsgi_params file you installed
    }
}
