v-add-web-domain-cgi 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/bash
  2. # info: add cgi support for domain
  3. # options: user domain
  4. #
  5. # The function switches on cgi support by adding +ExecCGI directive into
  6. # webserver configuration file. The use of this function is provided for
  7. # cases, when temporary cgi support is necessary, for other cases use of
  8. # templates is recommended.
  9. #----------------------------------------------------------#
  10. # Variable&Function #
  11. #----------------------------------------------------------#
  12. # Argument defenition
  13. user=$1
  14. domain=$(idn -t --quiet -u "$2" )
  15. domain_idn=$(idn -t --quiet -a "$domain")
  16. # Includes
  17. source $VESTA/conf/vesta.conf
  18. source $VESTA/func/main.sh
  19. source $VESTA/func/domain.sh
  20. #----------------------------------------------------------#
  21. # Verifications #
  22. #----------------------------------------------------------#
  23. check_args '2' "$#" 'user domain'
  24. validate_format 'user' 'domain'
  25. is_system_enabled "$WEB_SYSTEM"
  26. is_object_valid 'user' 'USER' "$user"
  27. is_object_unsuspended 'user' 'USER' "$user"
  28. is_object_valid 'web' 'DOMAIN' "$domain"
  29. is_object_unsuspended 'web' 'DOMAIN' "$domain"
  30. is_object_value_empty 'web' 'DOMAIN' "$domain" '$CGI'
  31. #----------------------------------------------------------#
  32. # Action #
  33. #----------------------------------------------------------#
  34. # Parsing domain values
  35. get_domain_values 'web'
  36. tpl_file="$WEBTPL/apache_$TPL.tpl"
  37. conf="$HOMEDIR/$user/conf/web/httpd.conf"
  38. CGI='yes'
  39. # Preparing domain values for the template substitution
  40. upd_web_domain_values
  41. # Recreating vhost
  42. del_web_config
  43. add_web_config
  44. # Checking ssl
  45. if [ "$SSL" = 'yes' ]; then
  46. tpl_file="$WEBTPL/apache_$TPL.stpl"
  47. conf="$HOMEDIR/$user/conf/web/shttpd.conf"
  48. del_web_config
  49. add_web_config
  50. fi
  51. #----------------------------------------------------------#
  52. # Vesta #
  53. #----------------------------------------------------------#
  54. # Update config value
  55. update_object_value 'web' 'DOMAIN' "$domain" '$CGI' 'yes'
  56. # Restart web server
  57. $BIN/v-restart-web "$EVENT"
  58. # Logging
  59. log_history "enabled cgi support for $domain"
  60. log_event "$OK" "$EVENT"
  61. exit