forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert_webip.sh
More file actions
executable file
·35 lines (27 loc) · 968 Bytes
/
convert_webip.sh
File metadata and controls
executable file
·35 lines (27 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Include vesta.conf
source /usr/local/vesta/conf/vesta.conf
# Check if old scheme is in use
check_oldip=$(grep "^Listen" /etc/$WEB_SYSTEM/conf.d/vesta.conf)
if [ -z "$check_oldip" ]; then
exit
fi
# Remove old ip definitions from vesta.conf
sed -i "/^Listen/d" /etc/$WEB_SYSTEM/conf.d/vesta.conf
sed -i "/^NameVirtualHost/d" /etc/$WEB_SYSTEM/conf.d/vesta.conf
sed -i "/^$/d" /etc/$WEB_SYSTEM/conf.d/vesta.conf
# Create new ip configs
for ip in $(ls /usr/local/vesta/data/ips); do
web_conf="/etc/$WEB_SYSTEM/conf.d/$ip.conf"
if [ "$WEB_SYSTEM" = 'httpd' ] || [ "$WEB_SYSTEM" = 'apache2' ]; then
echo "NameVirtualHost $ip:$WEB_PORT" > $web_conf
echo "Listen $ip:$WEB_PORT" >> $web_conf
fi
if [ "$WEB_SSL" = 'mod_ssl' ]; then
echo "NameVirtualHost $ip:$WEB_SSL_PORT" >> $web_conf
echo "Listen $ip:$WEB_SSL_PORT" >> $web_conf
fi
done
# Restart web server
/usr/local/vesta/bin/v-restart-web
exit