diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000000000000000000000000000000000000..9a7521751a7fb71f9a20e8e5923a3a247cc9fa7d --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,9 @@ +location PATHTOCHANGE/ { + alias ALIASTOCHANGE; + + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + + index index.html; +} diff --git a/scripts/install b/scripts/install index 50f03b77e3e9e6c335cff725a6eeb07edb8fea50..2eb0abc2de39cefb6fc3aa0be3a98ad63d9c116f 100644 --- a/scripts/install +++ b/scripts/install @@ -1,5 +1,7 @@ set -e +source ./commons + # Retrieve arguments domain=$1 path=$2 @@ -10,7 +12,23 @@ if [[ ! $? -eq 0 ]]; then exit 1 fi -source ./commons +install_static_file() { + final_path=/var/www/neutrinet + sudo mkdir -p $final_path + sudo cp -a ../sources/ $final_path + + sudo chown -R www-data: $final_path + + if [[ "$path" == "" ]]; then + sed -i "s@PATHTOCHANGE@/@g" ../conf/nginx.conf + else + sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf + fi + + sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf + + sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/neutrinet.conf +} install_renew_cert() { set -e @@ -53,6 +71,8 @@ sudo yunohost app setting neutrinet version -v "0.1.1" sudo yunohost app fetchlist -n neutrinet -u https://neutrinet.be/apps.json sudo yunohost app fetchlist -n labriqueinternet -u https://labriqueinter.net/apps/labriqueinternet.json +install_static_file + install_renew_cert # vpn is not running, let's assume for now that this mean that the vpn is broken