configure ssl in nginx

This commit is contained in:
Praveen Arimbrathodiyil 2016-02-07 14:22:01 +05:30
parent e1a6f889a3
commit e7b6777216
2 changed files with 29 additions and 16 deletions

View file

@ -10,3 +10,4 @@ gitlab_ssl_path=/etc/gitlab/ssl
gitlab_shell_root=/usr/share/gitlab-shell
gitlab_shell_log=/var/log/gitlab-shell
nginx_conf_example=/usr/share/doc/gitlab/nginx.conf.example
nginx_ssl_conf_example_gz=/usr/share/doc/gitlab/nginx.ssl.conf.example.gz

44
debian/postinst vendored
View file

@ -51,24 +51,36 @@ case "$1" in
su ${gitlab_user} -s /bin/sh -c 'git config --global core.autocrlf "input"'
cd ${gitlab_home}
db_get gitlab/fqdn
if [ "${RET}" != "" ]; then
if ! grep GITLAB_HOST ${gitlab_debian_conf}
then
echo GITLAB_HOST=${RET} >> ${gitlab_debian_conf}
echo GITLAB_EMAIL_FROM="no-reply@${RET}" >> ${gitlab_debian_conf}
echo GITLAB_EMAIL_DISPLAY_NAME="Gitlab" >> ${gitlab_debian_conf}
echo GITLAB_EMAIL_REPLY_TO="no-reply@${RET}" >> ${gitlab_debian_conf}
fi
if test -f ${nginx_conf_example}
if [ "${RET}" != "" ]; then
if ! grep GITLAB_HOST ${gitlab_debian_conf}
then
export GITLAB_HOST=${RET} # We need this to configure nginx below
echo GITLAB_HOST=${RET} >> ${gitlab_debian_conf}
echo GITLAB_EMAIL_FROM="no-reply@${RET}" >> ${gitlab_debian_conf}
echo GITLAB_EMAIL_DISPLAY_NAME="Gitlab" >> ${gitlab_debian_conf}
echo GITLAB_EMAIL_REPLY_TO="no-reply@${RET}" >> ${gitlab_debian_conf}
fi
db_get gitlab/ssl
if [ "${RET}" = "true" ]
then
if [ -f "${nginx_ssl_conf_example_gz}" ]
then
sed -e "s/YOUR_SERVER_FQDN/${RET}/"\
${nginx_conf_example} >/etc/nginx/sites-available/${RET}
ln -fs /etc/nginx/sites-available/${RET} /etc/nginx/sites-enabled/
else
echo "nginx.conf.example not found"
exit 1
# undo dh_installdocs auto compress
zcat ${nginx_ssl_conf_example_gz} >/tmp/gitlab-ssl
export nginx_conf_example="/tmp/gitlab-ssl"
fi
fi
if test -f ${nginx_conf_example}
then
sed -e "s/YOUR_SERVER_FQDN/${GITLAB_HOST}/"\
${nginx_conf_example} >/etc/nginx/sites-available/${GITLAB_HOST}
ln -fs /etc/nginx/sites-available/${RET} /etc/nginx/sites-enabled/
rm -f /tmp/gitlab-ssl
else
echo "nginx.conf.example not found"
exit 1
fi
else
echo "Failed to retrieve fully qualified domain name"