From b0bde1bf073fde81003007a65c6afcf42e74e563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Camhaji?= Date: Sat, 9 May 2015 16:57:11 +0200 Subject: [PATCH 1/2] fixed nginx configuration, upgraded syncthing to v 0.11.2 and renamed default storage folder (from 'sync' to 'storage') --- conf/nginx.conf | 5 +++-- scripts/install | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index a9280d5..4b40fb7 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,6 +1,7 @@ -location PATHTOCHANGE { +location PATHTOCHANGE/ { proxy_pass http://127.0.0.1:8080/; - proxy_pass https://127.0.0.1:8080/; + proxy_set_header Host $host; + proxy_buffering off; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; diff --git a/scripts/install b/scripts/install index 3c35928..71e5e96 100644 --- a/scripts/install +++ b/scripts/install @@ -5,11 +5,11 @@ domain=$1 path=$2 # Configurable variables -syncVersion="0.10.29" +syncVersion="0.11.2" syncHome="/home/yunohost.syncthing" syncUser=debian-syncthing syncSyncport=22000 -syncUIport=8080 +syncUIport=8384 arch=`uname -m` if [ "$arch" = "x86_64" ] ; then @@ -25,6 +25,7 @@ fi sudo yunohost app checkurl $domain$path -a syncthing if [[ ! $? -eq 0 ]]; then + echo $domain$path is not available. Please choose another url for Syncthing. exit 1 fi @@ -34,21 +35,23 @@ path=${path%/} # Check port availability sudo yunohost app checkport $syncUIport if [[ ! $? -eq 0 ]]; then + echo Port $syncUIport for Syncthing UI is not available. exit 1 fi sudo yunohost app checkport $syncSyncport if [[ ! $? -eq 0 ]]; then + echo Port $syncSyncport is for Syncthing protocol is not available. exit 1 fi # Open port in firewall sudo yunohost firewall allow TCP $syncSyncport > /dev/null 2>&1 -# Create $syncUser user to syncthing service +# Create $syncUser user to run syncthing service sudo useradd -m -d $syncHome/ -s /bin/bash $syncUser # Make directories and set rights -sudo mkdir -p $syncHome/{bin,sync} +sudo mkdir -p $syncHome/{bin,storage} sudo chown -R $syncUser:$syncUser $syncHome/ sudo find $syncHome/ -type f | while read LINE; do sudo chmod 640 "$LINE" ; done sudo find $syncHome/ -type d | while read LINE; do sudo chmod 750 "$LINE" ; done From 24b52f820747aa75dfe7d28158a20b0812234edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Camhaji?= Date: Sat, 9 May 2015 17:04:36 +0200 Subject: [PATCH 2/2] configure nginx port according to port defined in install script --- conf/nginx.conf | 2 +- scripts/install | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 4b40fb7..c769938 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,5 +1,5 @@ location PATHTOCHANGE/ { - proxy_pass http://127.0.0.1:8080/; + proxy_pass http://127.0.0.1:PORTTOCHANGE/; proxy_set_header Host $host; proxy_buffering off; diff --git a/scripts/install b/scripts/install index 71e5e96..9c8ee4d 100644 --- a/scripts/install +++ b/scripts/install @@ -72,6 +72,7 @@ sudo service syncthing start # Configure Nginx and reload sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf +sed -i "s@PORTTOCHANGE@$syncUIport@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/syncthing.conf sudo service nginx reload echo $?