diff --git a/upd/convert_webip.sh b/upd/convert_webip.sh new file mode 100755 index 00000000..210b5a99 --- /dev/null +++ b/upd/convert_webip.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Include vesta.conf +source /usr/local/vesta/conf/vesta.conf + +# Remove ol 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