diff --git a/etc/apache-bootstrap b/etc/apache-bootstrap index 629aee5..8893293 100755 --- a/etc/apache-bootstrap +++ b/etc/apache-bootstrap @@ -7,6 +7,16 @@ get_password () echo $(head -n 4096 /dev/urandom | tr -cd '[:alnum:]' | head -c ${1}) } +set_apache_server_name () +{ + local HOST_NAME=${1:-${APACHE_SERVER_NAME:-$(hostname)}} + local PORT=${2:-80} + + sed -i \ + -e "s~^#ServerName \(.*\):80$~ServerName ${HOST_NAME}:${PORT}~g" \ + /etc/httpd/conf/httpd.conf +} + APP_HOME_DIR_TEMPLATE="/var/www/.app-skel" OPTS_APACHE_SERVER_NAME="${APACHE_SERVER_NAME:-$(hostname)}" @@ -58,6 +68,9 @@ else exit 1 fi +# Add ServerName +set_apache_server_name ${OPTS_APACHE_SERVER_NAME} 80 + # If users need to change the vhost.conf the SSL version can be rebuilt if it is deleted if [[ ${OPTS_APACHE_MOD_SSL_ENABLED} == true ]] && [[ ! -f ${OPTS_APP_HOME_DIR}/vhost-ssl.conf ]] && [[ -f ${OPTS_APP_HOME_DIR}/vhost.conf ]]; then echo "Rebuilding the SSL VirtualHost configuration."