diff --git a/conf/nginx.conf b/conf/nginx.conf index 0daa8b7..3a4dcc9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,8 +1,8 @@ -location / { - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - proxy_pass http://localhost:3000/; - proxy_set_header Host $host; - proxy_buffering off; +location PATH/api { + proxy_pass http://127.0.0.1:3000; +} + +location PATH { + alias /usr/lib/node_modules/flood/dist/assets/; + try_files $uri PATH/index.html; } \ No newline at end of file diff --git a/scripts/install b/scripts/install index 0a2d5fe..cb20ea7 100755 --- a/scripts/install +++ b/scripts/install @@ -62,6 +62,7 @@ sudo npm i -g flood # Launch flood on boot cd $current_dir +ynh_replace_string "PATH" "$path_url" ../sources/flood.service sudo cp ../sources/flood.service /etc/systemd/system/flood.service systemctl daemon-reload systemctl enable flood.service @@ -80,6 +81,7 @@ sudo yunohost service add rtorrent sudo yunohost service add flood # nginx config +ynh_replace_string "PATH" "$path_url" ../conf/nginx.conf ynh_add_nginx_config # Start rtorrent and flood diff --git a/sources/flood.service b/sources/flood.service index d71e1ba..38a5f44 100644 --- a/sources/flood.service +++ b/sources/flood.service @@ -4,7 +4,7 @@ After=network.target [Service] WorkingDirectory=/var/www/flood -ExecStart=/usr/bin/npm start --production /var/www/flood +ExecStart=/usr/bin/npm start --production /var/www/flood --baseuri=PATH User=flood [Install] diff --git a/sources/rtorrent.service b/sources/rtorrent.service index 57138b8..9ed671a 100644 --- a/sources/rtorrent.service +++ b/sources/rtorrent.service @@ -1,11 +1,14 @@ [Unit] -Description=Flood Web UI +Description=rTorrent After=network.target [Service] -WorkingDirectory=~ -ExecStart=/usr/bin/flood User=flood +Type=forking +KillMode=none +ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/local/bin/rtorrent +ExecStop=/usr/bin/killall -w -s 2 /usr/local/bin/rtorrent +WorkingDirectory=%h [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=default.target \ No newline at end of file