diff --git a/conf/nginx.conf b/conf/nginx.conf index 44389f2..14603f1 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,11 +1,12 @@ location ^~ YNH_WWW_PATH { - alias YNH_WWW_FINALPATH/ ; - try_files $uri $uri/ /YNH_WWW_ROOTAPP/index.php?$query_string; - index /YNH_WWW_ROOTAPP/index.php; + alias YNH_WWW_FINALPATH/; + try_files $uri $uri/ /index.php?$query_string; + index YNH_WWW_ROOTPATH/index.php; - location YNH_WWW_ROOTPATH/ { try_files $uri $uri/ /YNH_WWW_ROOTAPP/index.php?$query_string; } - location YNH_WWW_ROOTPATH/api { try_files $uri $uri/ /YNH_WWW_ROOTAPP/api.php?$query_string; } - location YNH_WWW_ROOTPATH/admin { try_files $uri $uri/ /YNH_WWW_ROOTAPP/admin.php?$query_string; } + # These weird try_files ... see http://stackoverflow.com/a/35102259 + location YNH_WWW_ROOTPATH/ { try_files $uri $uri/ YNH_WWW_ROOTAPP/index.php?$query_string; } + location YNH_WWW_ROOTPATH/api { try_files $uri $uri/ YNH_WWW_ROOTAPP/api.php?$query_string; } + location YNH_WWW_ROOTPATH/admin { try_files $uri $uri/ YNH_WWW_ROOTAPP/admin.php?$query_string; } location YNH_WWW_ROOTPATH/flarum { deny all; diff --git a/scripts/install b/scripts/install index 7103393..9494f66 100644 --- a/scripts/install +++ b/scripts/install @@ -1,7 +1,7 @@ #!/bin/bash # Load extra functions -source .functions +source .functions # Activate TRAP to stop the script if an error is detected TRAP_ON @@ -108,10 +108,10 @@ ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" nginxconf="../conf/nginx.conf" if [ $path = "/" ]; then sed -i "s@YNH_WWW_ROOTPATH@@g" ../conf/nginx.conf - sed -i "s@/YNH_WWW_ROOTAPP@@g" ../conf/nginx.conf + sed -i "s@YNH_WWW_ROOTAPP@/@g" ../conf/nginx.conf else sed -i "s@YNH_WWW_ROOTPATH@$path@g" ../conf/nginx.conf - sed -i "s@YNH_WWW_ROOTAPP@$app@g" ../conf/nginx.conf + sed -i "s@YNH_WWW_ROOTAPP@$path$path@g" ../conf/nginx.conf fi sed -i "s@YNH_WWW_PATH@$path@g" $nginxconf sed -i "s@YNH_WWW_FINALPATH@$final_path@g" $nginxconf @@ -164,31 +164,18 @@ rootsql="INSERT INTO api_keys VALUES ('"$roottoken"')" ynh_mysql_execute_as_root "$apitablesql" $dbname ynh_mysql_execute_as_root "$rootsql" $dbname ynh_app_setting_set "$app" root_token "$roottoken" -fi # Configure SSOwat auth extension ssowatdomain=$(&2 echo "Admin : $admin, password : $adminpass. Change it!" diff --git a/scripts/upgrade b/scripts/upgrade index 5ceb4e3..36517ac 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,9 +21,12 @@ is_public=$(ynh_app_setting_get "$app" is_public) CHECK_PATH # Copy source files -src_path=/var/www/$app -sudo mkdir -p $src_path -sudo cp -a ../sources/. $src_path +#src_path=/var/www/$app +#sudo mkdir -p $src_path +#sudo cp -a ../sources/. $src_path + +# Update flarum +sudo su - www-data -s /bin/bash -c "cd /var/www/${app} && composer update" # Set permissions to app files # you may need to make some file and/or directory writeable by www-data (nginx user) @@ -32,14 +35,13 @@ sudo chmod -R 755 $src_path # Modify Nginx configuration file and copy it to Nginx conf directory ### Nginx ### -if [ $path = "/" ]; then nginxconf="../conf/nginx.conf" if [ $path = "/" ]; then sed -i "s@YNH_WWW_ROOTPATH@@g" ../conf/nginx.conf - sed -i "s@/YNH_WWW_ROOTAPP@@g" ../conf/nginx.conf + sed -i "s@YNH_WWW_ROOTAPP@/@g" ../conf/nginx.conf else sed -i "s@YNH_WWW_ROOTPATH@$path@g" ../conf/nginx.conf - sed -i "s@YNH_WWW_ROOTAPP@$app@g" ../conf/nginx.conf + sed -i "s@YNH_WWW_ROOTAPP@$path$path@g" ../conf/nginx.conf fi sed -i "s@YNH_WWW_PATH@$path@g" $nginxconf sed -i "s@YNH_WWW_FINALPATH@$final_path@g" $nginxconf