Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit 38f081b

Browse files
committed
ISSUE 41: Add function to set Apache's main ServerName.
1 parent de79a2b commit 38f081b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

etc/apache-bootstrap

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ get_password ()
77
echo $(head -n 4096 /dev/urandom | tr -cd '[:alnum:]' | head -c ${1})
88
}
99

10+
set_apache_server_name ()
11+
{
12+
local HOST_NAME=${1:-${APACHE_SERVER_NAME:-$(hostname)}}
13+
local PORT=${2:-80}
14+
15+
sed -i \
16+
-e "s~^#ServerName \(.*\):80$~ServerName ${HOST_NAME}:${PORT}~g" \
17+
/etc/httpd/conf/httpd.conf
18+
}
19+
1020
APP_HOME_DIR_TEMPLATE="/var/www/.app-skel"
1121

1222
OPTS_APACHE_SERVER_NAME="${APACHE_SERVER_NAME:-$(hostname)}"
@@ -58,6 +68,9 @@ else
5868
exit 1
5969
fi
6070

71+
# Add ServerName
72+
set_apache_server_name ${OPTS_APACHE_SERVER_NAME} 80
73+
6174
# If users need to change the vhost.conf the SSL version can be rebuilt if it is deleted
6275
if [[ ${OPTS_APACHE_MOD_SSL_ENABLED} == true ]] && [[ ! -f ${OPTS_APP_HOME_DIR}/vhost-ssl.conf ]] && [[ -f ${OPTS_APP_HOME_DIR}/vhost.conf ]]; then
6376
echo "Rebuilding the SSL VirtualHost configuration."

0 commit comments

Comments
 (0)