convert_webip.sh 826 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. # Include vesta.conf
  3. source /usr/local/vesta/conf/vesta.conf
  4. # Remove ol ip definitions from vesta.conf
  5. sed -i "/^Listen/d" /etc/$WEB_SYSTEM/conf.d/vesta.conf
  6. sed -i "/^NameVirtualHost/d" /etc/$WEB_SYSTEM/conf.d/vesta.conf
  7. sed -i "/^$/d" /etc/$WEB_SYSTEM/conf.d/vesta.conf
  8. # Create new ip configs
  9. for ip in $(ls /usr/local/vesta/data/ips); do
  10. web_conf="/etc/$WEB_SYSTEM/conf.d/$ip.conf"
  11. if [ "$WEB_SYSTEM" = 'httpd' ] || [ "$WEB_SYSTEM" = 'apache2' ]; then
  12. echo "NameVirtualHost $ip:$WEB_PORT" > $web_conf
  13. echo "Listen $ip:$WEB_PORT" >> $web_conf
  14. fi
  15. if [ "$WEB_SSL" = 'mod_ssl' ]; then
  16. echo "NameVirtualHost $ip:$WEB_SSL_PORT" >> $web_conf
  17. echo "Listen $ip:$WEB_SSL_PORT" >> $web_conf
  18. fi
  19. done
  20. # Restart web server
  21. /usr/local/vesta/bin/v-restart-web
  22. exit