diff --git a/conf/nginx.conf b/conf/nginx.conf index 070736c..f864b30 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,6 +1,22 @@ -location / { - proxy_pass http://localhost:__PORT__; - proxy_set_header Host $host; - proxy_buffering off; +location ^~ / { + # Force usage of https + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + + proxy_pass http://127.0.0.1:__PORT__/; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; + + proxy_http_version 1.1; + proxy_set_header Connection "upgrade"; + proxy_set_header Upgrade $http_upgrade; + + # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; -} + more_clear_input_headers 'Accept-Encoding'; +} \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index a785cec..51022a2 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,8 @@ User=__APP__ Group=__APP__ Environment="NODE_ENV=production" Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=/usr/bin/ethercalc --port __PORT__ --expire __EXPIRE__ +WorkingDirectory=__FINALPATH__ +ExecStart=/ethercalc --port __PORT__ --expire __EXPIRE__ RuntimeMaxSec=86400 Restart=always diff --git a/scripts/install b/scripts/install index 310542b..c69f956 100644 --- a/scripts/install +++ b/scripts/install @@ -33,7 +33,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --time --weight=1 +ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -55,7 +55,7 @@ ynh_app_setting_set --app=$app --key=expire --value=$expire #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Configuring firewall..." --time --weight=1 +ynh_script_progression --message="Configuring firewall..." --weight=3 port=$(ynh_find_port --port=8095) ynh_app_setting_set --app=$app --key=port --value=$port diff --git a/scripts/remove b/scripts/remove index 51cb38c..2684af4 100644 --- a/scripts/remove +++ b/scripts/remove @@ -28,14 +28,14 @@ final_path=$(ynh_app_setting_get $app final_path) # Remove the service from the list of services known by Yunohost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service integration..." --time --weight=1 + ynh_script_progression --message="Removing $app service integration..." --weight=2 yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 # Remove the dedicated systemd config ynh_remove_systemd_config @@ -43,7 +43,7 @@ ynh_remove_systemd_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --time --weight=1 +ynh_script_progression --message="Removing dependencies..." --weight=2 # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -51,15 +51,15 @@ ynh_remove_app_dependencies #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --time --weight=1 +ynh_script_progression --message="Removing app main directory..." --weight=2 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -69,7 +69,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user ynh_system_user_delete --username=$app @@ -78,5 +78,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --time --last - +ynh_script_progression --message="Removal of $app completed" --last