Compare commits
3 Commits
d733f15917
...
51b506b232
| Author | SHA1 | Date | |
|---|---|---|---|
| 51b506b232 | |||
| 67601bc643 | |||
| 7129919073 |
@ -6,6 +6,8 @@ location __PATH__/ {
|
|||||||
|
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
|
# allowed subnets
|
||||||
|
deny all;
|
||||||
|
|
||||||
location ~ \.php {
|
location ~ \.php {
|
||||||
fastcgi_split_path_info ^(.+\.php)(.*)$;
|
fastcgi_split_path_info ^(.+\.php)(.*)$;
|
||||||
|
|||||||
@ -44,5 +44,5 @@ ram.runtime = "1M"
|
|||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
main.url = "/"
|
main.url = "/"
|
||||||
|
|
||||||
[resources.apt]
|
# [resources.apt]
|
||||||
packages = "php8.2-fpm"
|
# packages = "php8.2-fpm"
|
||||||
|
|||||||
@ -39,9 +39,32 @@ chmod 600 "/etc/sudoers.d/$app"
|
|||||||
# WEBSERVER CONFIGURATION
|
# WEBSERVER CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding php-fpm configuration …" --weight=1
|
ynh_script_progression --message="Adding php-fpm configuration …" --weight=1
|
||||||
|
|
||||||
|
# find default php version
|
||||||
|
php_executable=$(readlink -f "$(which php)")
|
||||||
|
echo "${php_executable:(-3)}"
|
||||||
|
ynh_app_setting_set --app=$app --key="phpversion" --value="${php_executable:(-3)}"
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
|
||||||
|
|
||||||
ynh_script_progression --message="Adding nginx configuration …" --weight=1
|
ynh_script_progression --message="Adding nginx configuration …" --weight=1
|
||||||
|
# get local subnet address ranges from routing table
|
||||||
|
ranges=$(netstat -nr | grep -o "^\(192\.168\|172.\(1[6-9]\|2[0-9]\|3[01]\)\|10\.[0-9]\+\)\.[0-9]\+\.[0-9]\+")
|
||||||
|
# add allow statement to nginx config for each subnet range in CIDR notation
|
||||||
|
for range in $ranges; do
|
||||||
|
case $(echo "$range" | awk -F '.' '{print $1}') in
|
||||||
|
192)
|
||||||
|
cidr=24
|
||||||
|
;;
|
||||||
|
172)
|
||||||
|
cidr=12
|
||||||
|
;;
|
||||||
|
10)
|
||||||
|
cidr=8
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
sed -i "/# allowed subnets/a allow ${range}/${cidr}; # added by install script" nginx.conf;
|
||||||
|
done
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,13 +6,18 @@ source /usr/share/yunohost/helpers
|
|||||||
# REMOVE THE NGINX CONFIGURATION
|
# REMOVE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1
|
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1
|
||||||
|
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE THE FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing php-fpm configuration..." --weight=1
|
||||||
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SUDOERS CONFIGURATION
|
# REMOVE SUDOERS CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing sudoers configuration..." --weight=1
|
ynh_script_progression --message="Removing sudoers configuration..." --weight=1
|
||||||
|
|
||||||
rm /etc/sudoers.d/$app
|
rm /etc/sudoers.d/$app
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user