Add configs (resolve #2)

This commit is contained in:
Oskar Winkels 2020-12-07 23:00:51 +01:00 committed by Oskar
parent 8a57b0cd84
commit 6760ed65a2
3 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,36 @@
server {
listen 443 ssl;
server_name quiz.fasttube.de;
root /root/fs-quiz-tool/web;
index index.html;
location / {
# First attempt to serve request as file
# If no such file, pass to backend
try_files $uri $uri/ =404;
}
location /db {
proxy_pass http://127.0.0.1:12345;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
ssl_certificate /usr/local/etc/letsencrypt/live/quiz.fasttube.de/fullchain.pem;
ssl_certificate_key /usr/local/etc/letsencrypt/live/quiz.fasttube.de/privkey.pem;
}
server {
server_name quiz.fasttube.de;
listen 80;
# 308 instead of 301 to prohibit method change on redirect
# (some clients change POST to GET on 301, 308 does not allow that)
return 308 https://$host$request_uri;
}

25
res/fs-quiz-tool.rc Normal file
View File

@ -0,0 +1,25 @@
#!/bin/sh
# PROVIDE: fs_quiz_tool
# REQUIRE: LOGIN DAEMON NETWORKING
# KEYWORD: fasttube fs quiz tool
# Enable this script by adding:
# fs_quiz_tool_enable="YES"
# ... to /etc/rc.conf
. /etc/rc.subr
name="fs_quiz_tool"
rcvar="fs_quiz_tool_enable"
pidfile="/var/run/${name}.pid"
task="/usr/local/bin/python3.7 -m fs-quiz-tool-db"
procname="/usr/local/bin/python3.7"
command="/usr/sbin/daemon"
command_args="-p ${pidfile} ${task}"
load_rc_config ${name}
run_rc_command "$1"

11
res/fs-quiz-tool.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=FaSTTUBe FS Quiz Tool
After=syslog.target network.target nginx.service
[Service]
User=www-data
ExecStart=/usr/bin/python3 -m fs-quiz-tool-db
Restart=always
[Install]
WantedBy=multi-user.target