user www-data;
worker_processes auto;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {
    client_max_body_size 2G;

    server {
		access_log /dev/stdout;
		error_log  /dev/stdout;
		server_name meth.com;
		listen 8000 ssl;
	
		ssl_protocols TLSv1.2 TLSv1.3;
		ssl_certificate /etc/nginx/ssl/inception.crt;
		ssl_certificate_key /etc/nginx/ssl/inception.key;
	
		root /var/www/;
		include /etc/nginx/mime.types;
	
		location /static/ {
		    alias /var/www/static/;
		}
	
		location / {
		    proxy_pass http://djangoserver:8000;
		    proxy_set_header Host $host;
		    proxy_set_header X-Real-IP $remote_addr;
		    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		    proxy_set_header X-Forwarded-Proto $scheme;
		}
		
		location /ws {
		    proxy_pass http://djangoserver:8000;
		    proxy_http_version 1.1;
		    proxy_set_header Upgrade $http_upgrade;
		    proxy_set_header Connection "upgrade";
		    proxy_set_header Host $host;
		    proxy_set_header X-Real-IP $remote_addr;
		    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		    proxy_set_header X-Forwarded-Proto $scheme;
		    proxy_read_timeout 86400;
		}
		
		location /admin {
			proxy_pass http://adminer:8080;
		}
    }
}
