mirror of
https://github.com/YunoHost-Apps/my_webapp_ynh.git
synced 2024-09-03 19:46:26 +02:00
35 lines
1.2 KiB
Bash
35 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
# Retrieve arguments
|
|
domain=$(sudo yunohost app setting my_webapp domain)
|
|
path=$(sudo yunohost app setting my_webapp path)
|
|
user=$(sudo yunohost app setting my_webapp ftp_user)
|
|
is_public=$(sudo yunohost app setting my_webapp is_public)
|
|
final_path=/var/www/my_webapp
|
|
|
|
# Change user ID in configurations
|
|
sed -i "s/FTPUSER/$user/g" ../conf/ldap.conf
|
|
sed -i "s/FTPDIR/$final_path/g" ../conf/ldap.conf
|
|
|
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
|
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
|
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/my_webapp.conf
|
|
|
|
# Make app public if necessary
|
|
if [ $is_public = "Yes" ];
|
|
then
|
|
sudo yunohost app setting my_webapp skipped_uris -v "/"
|
|
fi
|
|
|
|
# Adapt PureFTPd configuration
|
|
sudo cp ../conf/ldap.conf /etc/pure-ftpd/db/
|
|
sudo sh -c 'echo "yes" > /etc/pure-ftpd/conf/NoAnonymous'
|
|
sudo sh -c 'echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone'
|
|
sudo sh -c 'echo "no" > /etc/pure-ftpd/conf/UnixAuthentication'
|
|
sudo sh -c 'echo "50000 50100" > /etc/pure-ftpd/conf/PassivePortRange'
|
|
|
|
# Reload Nginx, restart PureFTPd and regenerate SSOwat conf
|
|
sudo service nginx reload
|
|
sudo service pure-ftpd-ldap restart
|
|
sudo yunohost app ssowatconf
|