Fix install php interface
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
location <TPL:NGINX_LOCATION> {
|
location <TPL:NGINX_LOCATION> {
|
||||||
alias <TPL:NGINX_ALIAS>;
|
alias <TPL:NGINX_REALPATH>;
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ location <TPL:NGINX_LOCATION> {
|
|||||||
try_files $uri $uri/ index.php;
|
try_files $uri $uri/ index.php;
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-roundcube.sock;
|
fastcgi_pass unix:/var/run/php5-fpm-<TPL:PHP_NAME>.sock;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
; specific port;
|
; specific port;
|
||||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||||
; Note: This value is mandatory.
|
; Note: This value is mandatory.
|
||||||
listen = /var/run/php5-fpm-NAMETOCHANGE.sock
|
listen = /var/run/php5-fpm-<TPL:PHP_NAME>.sock
|
||||||
|
|
||||||
; Set listen(2) backlog. A value of '-1' means unlimited.
|
; Set listen(2) backlog. A value of '-1' means unlimited.
|
||||||
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
|
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
|
||||||
@@ -170,7 +170,7 @@ request_slowlog_timeout = 5s
|
|||||||
; The log file for slow requests
|
; The log file for slow requests
|
||||||
; Default Value: not set
|
; Default Value: not set
|
||||||
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
||||||
slowlog = /var/log/nginx/NAMETOCHANGE.slow.log
|
slowlog = /var/log/nginx/<TPL:PHP_NAME>.slow.log
|
||||||
|
|
||||||
; Set open file descriptor rlimit.
|
; Set open file descriptor rlimit.
|
||||||
; Default Value: system defined value
|
; Default Value: system defined value
|
||||||
@@ -195,7 +195,7 @@ rlimit_core = 0
|
|||||||
; Chdir to this directory at the start.
|
; Chdir to this directory at the start.
|
||||||
; Note: relative path can be used.
|
; Note: relative path can be used.
|
||||||
; Default Value: current directory or / when chroot
|
; Default Value: current directory or / when chroot
|
||||||
chdir = /var/www/NAMETOCHANGE
|
chdir = <TPL:NGINX_REALPATH>
|
||||||
|
|
||||||
; Redirect worker stdout and stderr into main error log. If not set, stdout and
|
; Redirect worker stdout and stderr into main error log. If not set, stdout and
|
||||||
; stderr will be redirected to /dev/null according to FastCGI specs.
|
; stderr will be redirected to /dev/null according to FastCGI specs.
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
"en": "Choose a path for your VPN web administration"
|
"en": "Choose a path for your VPN web administration"
|
||||||
},
|
},
|
||||||
"example": "/vpnadmin",
|
"example": "/vpnadmin",
|
||||||
"example": "/vpnadmin"
|
"default": "/vpnadmin"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Server name",
|
"name": "Server name",
|
||||||
|
@@ -4,10 +4,10 @@
|
|||||||
domain=$1
|
domain=$1
|
||||||
url_path=$2
|
url_path=$2
|
||||||
server_name=$3
|
server_name=$3
|
||||||
crt_client_path=$2
|
crt_client_path=$4
|
||||||
crt_client_key_path=$3
|
crt_client_key_path=$5
|
||||||
crt_server_ca_path=$4
|
crt_server_ca_path=$6
|
||||||
ip6_net=$5
|
ip6_net=$7
|
||||||
|
|
||||||
# Check arguments
|
# Check arguments
|
||||||
# TODO
|
# TODO
|
||||||
@@ -32,6 +32,10 @@ ip6_addr=$(echo "$(echo ${ip6_expanded_net} | cut -d: -f1-7):1")
|
|||||||
ip6_addr=$(sipcalc ${ip6_addr} | grep Compressed | awk '{ print $NF; }')
|
ip6_addr=$(sipcalc ${ip6_addr} | grep Compressed | awk '{ print $NF; }')
|
||||||
server_ip6=$(host ${server_name} | awk '/IPv6/ { print $NF; }')
|
server_ip6=$(host ${server_name} | awk '/IPv6/ { print $NF; }')
|
||||||
|
|
||||||
|
if [ -z "${server_ip6}" ]; then
|
||||||
|
server_ip6=$(host ${server_name} 80.67.188.188 | awk '/IPv6/ { print $NF; }')
|
||||||
|
fi
|
||||||
|
|
||||||
# Save arguments for future upgrades
|
# Save arguments for future upgrades
|
||||||
sudo yunohost app setting vpnclient wired_device -v ${wired_device}
|
sudo yunohost app setting vpnclient wired_device -v ${wired_device}
|
||||||
sudo yunohost app setting vpnclient ip6_addr -v ${ip6_addr}
|
sudo yunohost app setting vpnclient ip6_addr -v ${ip6_addr}
|
||||||
@@ -47,7 +51,7 @@ sudo install -b -o root -g root -m 0644 ../conf/phpfpm_vpnadmin.conf /etc/php5/f
|
|||||||
# Copy web sources
|
# Copy web sources
|
||||||
sudo mkdir -pm 0755 /var/www/vpnadmin/
|
sudo mkdir -pm 0755 /var/www/vpnadmin/
|
||||||
|
|
||||||
sudo cp -a ../conf/sources/* /var/www/vpnadmin/
|
sudo cp -a ../sources/* /var/www/vpnadmin/
|
||||||
|
|
||||||
sudo chown -R root: /var/www/vpnadmin/
|
sudo chown -R root: /var/www/vpnadmin/
|
||||||
sudo chmod -R 0644 /var/www/vpnadmin/*
|
sudo chmod -R 0644 /var/www/vpnadmin/*
|
||||||
@@ -72,12 +76,14 @@ sudo sed "s|<TPL:SERVER_NAME>|${server_name}|g" -i /etc/openvpn/client.conf.tpl
|
|||||||
|
|
||||||
## nginx
|
## nginx
|
||||||
sudo sed "s|<TPL:NGINX_LOCATION>|${url_path}|g" -i /etc/nginx/conf.d/${domain}.d/vpnadmin.conf
|
sudo sed "s|<TPL:NGINX_LOCATION>|${url_path}|g" -i /etc/nginx/conf.d/${domain}.d/vpnadmin.conf
|
||||||
sudo sed 's|<TPL:NGINX_ALIAS>|/var/www/vpnadmin/|g' -i /etc/nginx/conf.d/${domain}.d/vpnadmin.conf
|
sudo sed 's|<TPL:NGINX_REALPATH>|/var/www/vpnadmin/|g' -i /etc/nginx/conf.d/${domain}.d/vpnadmin.conf
|
||||||
|
sudo sed 's|<TPL:PHP_NAME>|vpnadmin|g' -i /etc/nginx/conf.d/${domain}.d/vpnadmin.conf
|
||||||
|
|
||||||
# php-fpm
|
# php-fpm
|
||||||
sudo sed 's|<TPL:PHP_NAME>|vpnadmin|g' -i /etc/php5/fpm/pool.d/vpnadmin.conf
|
sudo sed 's|<TPL:PHP_NAME>|vpnadmin|g' -i /etc/php5/fpm/pool.d/vpnadmin.conf
|
||||||
sudo sed 's|<TPL:PHP_USER>|vpnadmin|g' -i /etc/php5/fpm/pool.d/vpnadmin.conf
|
sudo sed 's|<TPL:PHP_USER>|vpnadmin|g' -i /etc/php5/fpm/pool.d/vpnadmin.conf
|
||||||
sudo sed 's|<TPL:PHP_GROUP>|vpnadmin|g' -i /etc/php5/fpm/pool.d/vpnadmin.conf
|
sudo sed 's|<TPL:PHP_GROUP>|vpnadmin|g' -i /etc/php5/fpm/pool.d/vpnadmin.conf
|
||||||
|
sudo sed 's|<TPL:NGINX_REALPATH>|/var/www/vpnadmin/|g' -i /etc/php5/fpm/pool.d/vpnadmin.conf
|
||||||
|
|
||||||
# Copy init script
|
# Copy init script
|
||||||
sudo install -b -o root -g root -m 0755 ../conf/init_ynh-vpnclient /etc/init.d/ynh-vpnclient
|
sudo install -b -o root -g root -m 0755 ../conf/init_ynh-vpnclient /etc/init.d/ynh-vpnclient
|
||||||
|
@@ -1,16 +1,32 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
domain=$(sudo yunohost app setting vpnclient domain)
|
||||||
|
|
||||||
# The End
|
# The End
|
||||||
sudo yunohost service stop ynh-vpnclient
|
sudo yunohost service stop ynh-vpnclient
|
||||||
sudo yunohost service remove ynh-vpnclient
|
sudo yunohost service remove ynh-vpnclient
|
||||||
sudo rm -f /etc/init.d/ynh-vpnclient
|
sudo rm -f /etc/init.d/ynh-vpnclient
|
||||||
|
|
||||||
# Remove confs
|
# Remove confs
|
||||||
sudo rm -f /etc/openvpn/client.conf*
|
sudo rm -f /etc/openvpn/client.conf{.tpl,}
|
||||||
|
sudo rm -f /etc/nginx/conf.d/${domain}.d/vpnadmin.conf
|
||||||
|
sudo rm -f /etc/php5/fpm/pool.d/vpnadmin.conf
|
||||||
|
|
||||||
# Remove certificates
|
# Remove certificates
|
||||||
sudo rm -rf /etc/openvpn/keys/
|
sudo rm -rf /etc/openvpn/keys/
|
||||||
|
|
||||||
|
# Restart services
|
||||||
|
sudo yunohost service stop php5-fpm
|
||||||
|
sudo yunohost service start php5-fpm
|
||||||
|
sudo service nginx reload
|
||||||
|
|
||||||
|
# Remove sources
|
||||||
|
sudo rm -rf /var/www/vpnadmin/
|
||||||
|
|
||||||
|
# Remove user
|
||||||
|
sudo userdel -f vpnadmin
|
||||||
|
|
||||||
# Restart hotspot service if installed to change NAT configuration
|
# Restart hotspot service if installed to change NAT configuration
|
||||||
sudo yunohost app list -f hotspot --json | grep -q '"installed": true'
|
sudo yunohost app list -f hotspot --json | grep -q '"installed": true'
|
||||||
if [ "$?" -eq 0 ]; then
|
if [ "$?" -eq 0 ]; then
|
||||||
@@ -21,7 +37,7 @@ fi
|
|||||||
|
|
||||||
# Remove packets
|
# Remove packets
|
||||||
# The yunohost policy is currently to not uninstall packets (dependency problems)
|
# The yunohost policy is currently to not uninstall packets (dependency problems)
|
||||||
## sudo apt-get --assume-yes --force-yes remove openvpn
|
## sudo apt-get --assume-yes --force-yes remove openvpn php5-fpm
|
||||||
## sudo apt-get --assume-yes --force-yes remove sipcalc
|
## sudo apt-get --assume-yes --force-yes remove sipcalc
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Reference in New Issue
Block a user