mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
[fix] Prevent to redefine .well-known paths (fix #400)
This commit is contained in:
parent
25698019e7
commit
30086cb956
2 changed files with 20 additions and 1 deletions
|
@ -72,6 +72,13 @@ sed -i "s@#APP#@${app}@g" ../conf/nginx.conf
|
||||||
sed -i "s@#PATH#@${path}@g" ../conf/nginx.conf
|
sed -i "s@#PATH#@${path}@g" ../conf/nginx.conf
|
||||||
sed -i "s@#LOCATION#@${path:-/}@g" ../conf/nginx.conf
|
sed -i "s@#LOCATION#@${path:-/}@g" ../conf/nginx.conf
|
||||||
sed -i "s@#DESTDIR#@${DESTDIR}@g" ../conf/nginx.conf
|
sed -i "s@#DESTDIR#@${DESTDIR}@g" ../conf/nginx.conf
|
||||||
|
# check if .well-known is already served on the domain
|
||||||
|
if [[ $(curl -s -o /dev/null -w '%{http_code}' \
|
||||||
|
"https://${domain}/.well-known/caldav") =~ ^[23] ]] ; then
|
||||||
|
# ... and delete it from nginx configuration
|
||||||
|
sed -ri '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' \
|
||||||
|
../conf/nginx.conf
|
||||||
|
fi
|
||||||
sudo cp ../conf/nginx.conf "$nginx_conf"
|
sudo cp ../conf/nginx.conf "$nginx_conf"
|
||||||
|
|
||||||
# Copy and set php-fpm configuration
|
# Copy and set php-fpm configuration
|
||||||
|
|
|
@ -38,12 +38,24 @@ DATADIR="/home/yunohost.app/${app}/data"
|
||||||
ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \
|
ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \
|
||||||
|| ynh_die "Unable to upgrade dependencies"
|
|| ynh_die "Unable to upgrade dependencies"
|
||||||
|
|
||||||
# Copy and set nginx configuration
|
# FIXME: Delete current nginx configuration to be able to check if
|
||||||
|
# .well-known is already served. See https://dev.yunohost.org/issues/400
|
||||||
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||||
|
sudo rm -f "$nginx_conf"
|
||||||
|
sudo service nginx reload
|
||||||
|
|
||||||
|
# Copy and set nginx configuration
|
||||||
sed -i "s@#APP#@${app}@g" ../conf/nginx.conf
|
sed -i "s@#APP#@${app}@g" ../conf/nginx.conf
|
||||||
sed -i "s@#PATH#@${path}@g" ../conf/nginx.conf
|
sed -i "s@#PATH#@${path}@g" ../conf/nginx.conf
|
||||||
sed -i "s@#LOCATION#@${path:-/}@g" ../conf/nginx.conf
|
sed -i "s@#LOCATION#@${path:-/}@g" ../conf/nginx.conf
|
||||||
sed -i "s@#DESTDIR#@${DESTDIR}@g" ../conf/nginx.conf
|
sed -i "s@#DESTDIR#@${DESTDIR}@g" ../conf/nginx.conf
|
||||||
|
# check if .well-known is already served on the domain
|
||||||
|
if [[ $(curl -s -o /dev/null -w '%{http_code}' \
|
||||||
|
"https://${domain}/.well-known/caldav") =~ ^[23] ]] ; then
|
||||||
|
# ... and delete it from nginx configuration
|
||||||
|
sed -ri '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' \
|
||||||
|
../conf/nginx.conf
|
||||||
|
fi
|
||||||
sudo cp ../conf/nginx.conf "$nginx_conf"
|
sudo cp ../conf/nginx.conf "$nginx_conf"
|
||||||
|
|
||||||
# Copy and set php-fpm configuration
|
# Copy and set php-fpm configuration
|
||||||
|
|
Loading…
Add table
Reference in a new issue