1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-23 02:27:05 +00:00
mailinabox/scripts/web.sh

31 lines
788 B
Bash
Raw Normal View History

2013-09-01 14:24:49 +00:00
# HTTP: Turn on a web server serving static files
#################################################
2013-09-07 20:53:25 +00:00
apt-get install -q -y \
nginx
2013-09-01 14:24:49 +00:00
2013-09-07 20:53:25 +00:00
rm -f /etc/nginx/sites-enabled/default
STORAGE_ROOT_ESC=$(echo $STORAGE_ROOT|sed 's/[\\\/&]/\\&/g')
PUBLIC_HOSTNAME_ESC=$(echo $PUBLIC_HOSTNAME|sed 's/[\\\/&]/\\&/g')
2013-09-01 14:24:49 +00:00
# copy in the nginx configuration file and substitute some
# variables
2013-09-01 14:24:49 +00:00
cat conf/nginx.conf \
2013-09-07 20:53:25 +00:00
| sed "s/\$STORAGE_ROOT/$STORAGE_ROOT_ESC/g" \
| sed "s/\$PUBLIC_HOSTNAME/$PUBLIC_HOSTNAME_ESC/g" \
> /etc/nginx/conf.d/local.conf
# make a default homepage
2013-09-07 20:53:25 +00:00
mkdir -p $STORAGE_ROOT/www/static
cp conf/www_default.html $STORAGE_ROOT/www/static/index.html
chown -R $STORAGE_USER $STORAGE_ROOT/www/static/index.html
2013-09-07 20:53:25 +00:00
service nginx restart
2013-09-01 14:24:49 +00:00
2013-09-07 20:53:25 +00:00
conf/php-fcgid start
2013-09-01 14:24:49 +00:00
ufw allow http
ufw allow https