Use Sanic

This commit is contained in:
2019-03-08 18:35:21 +03:00
parent 6cf94b0efe
commit 9cc13191d4
16 changed files with 340 additions and 4590 deletions

View File

@@ -1,65 +1,45 @@
server {
server_name drop.bakatrouble.pw;
location /_ {
alias /srv/apps/drop/files;
}
location / {
include uwsgi_params;
uwsgi_pass unix:///tmp/drop.sock;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/bakatrouble.pw/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/bakatrouble.pw/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
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 ~^(?<dir>.*)\.drop\.bakatrouble\.pw$;
server_name ~^drop\.bakatrouble\.(pw|me)$;
root /srv/apps/drop/files;
location /_ {
alias /srv/apps/drop/subdomain_files/$dir;
}
location /~static/ {
alias /srv/apps/drop/~static;
}
location / {
include uwsgi_params;
uwsgi_pass unix:///tmp/drop.sock;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/bakatrouble.pw/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/bakatrouble.pw/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
location / {
try_files $uri @drop_app;
}
include /etc/nginx/letsencrypt-serv.conf;
}
server {
if ($host = drop.bakatrouble.pw) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name ~^(?<dir>.*)\.drop\.bakatrouble\.(pw|me)$;
root /srv/apps/drop/subdomain_files/$dir;
if ($host ~ ^(?<dir>.*)\.drop\.bakatrouble\.pw$) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name drop.bakatrouble.pw ~^(?<dir>.*)\.drop\.bakatrouble\.pw$;
return 404; # managed by Certbot
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;
}

View File

@@ -1,9 +1,10 @@
[program:drop]
user = arch
directory = /srv/apps/drop
command = /srv/apps/drop/venv/bin/uwsgi --ini /srv/apps/drop/configs/uwsgi.ini
command = /srv/apps/drop/venv/bin/python /srv/apps/drop/autoindex.py
autostart = true
autorestart = true
stderr_logfile = /srv/apps/drop/logs/uwsgi_err.log
stdout_logfile = /srv/apps/drop/logs/uwsgi_out.log
stderr_logfile = /srv/apps/drop/logs/app.log
stdout_logfile = /srv/apps/drop/logs/app.log
stopsignal = INT
environment = ENV=PRODUCTION

View File

@@ -1,7 +0,0 @@
[uwsgi]
socket = /tmp/drop.sock
chmod-socket = 666
module = autoindex:application
master = true
processes = 2
enable-threads = true