Add nginx and systemd config files

This commit is contained in:
Jeena 2023-09-22 21:24:14 +09:00
parent 5e2e146b65
commit 1b4cfec72c
2 changed files with 53 additions and 0 deletions

19
fxsync.service Normal file
View file

@ -0,0 +1,19 @@
[Unit]
Description=Firefox sync server
Requires=docker.service
After=docker.service
[Service]
Restart=always
User=jeena
Group=docker
WorkingDirectory=/home/jeena/fxsync.jeena.net
# Shutdown container (if running) when unit is started
ExecStartPre=/usr/bin/docker-compose -f docker-compose.yaml down
# Start container when unit is started
ExecStart=/usr/bin/docker-compose -f docker-compose.yaml up
# Stop container when unit is stopped
ExecStop=/usr/bin/docker-compose -f docker-compose.yaml down
[Install]
WantedBy=multi-user.target

34
nginx-example-com.conf Normal file
View file

@ -0,0 +1,34 @@
server {
if ($host = fxsync.example.com) {
return 301 https://$host$request_uri;
}
listen 80;
listen [::]:80;
server_name fxsync.example.com;
access_log /var/log/nginx/fxsync.example.com-access.log;
error_log /var/log/nginx/fxsync.example.com-error.log;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name fxsync.example.com;
location / {
proxy_pass http://localhost:5000;
proxy_set_header Host $http_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_redirect off;
proxy_read_timeout 120;
proxy_connect_timeout 10;
gzip off;
}
ssl_certificate /etc/letsencrypt/live/fxsync.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/fxsync.example.com/privkey.pem; # managed by Certbot
}