location @drop_app { proxy_pass unix:///tmp/drop.sock; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; } server { server_name ~^drop\.bakatrouble\.(pw|me)$; root /srv/apps/drop/files; location /~static/ { alias /srv/apps/drop/~static; } location / { try_files $uri @drop_app; } include /etc/nginx/letsencrypt-serv.conf; } server { server_name ~^(?.*)\.drop\.bakatrouble\.(pw|me)$; root /srv/apps/drop/subdomain_files/$dir; location /~static/ { alias /srv/apps/drop/~static; } location / { try_files $uri @drop_app; } include /etc/nginx/letsencrypt-serv.conf; } server { if ($host ~ ^(.*\.)?drop\.bakatrouble\.(pw|me)$) { return 301 https://$host$request_uri; } listen 80; server_name ~^(.*\.)?drop\.bakatrouble\.(pw|me)$; return 404; }