#!/bin/bash

echo Setting up virtual host

# cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.default
# cp /init/nginx.conf /etc/nginx/nginx.conf
# rm /etc/nginx/sites-available/default
cp /init/default-virtual-host /etc/nginx/sites-available/default
cp /init/default-one.mosz.com.tw /etc/nginx/sites-available/one.mosz.com.tw.conf
# cp /init/default-virtual-host /etc/nginx/sites-enabled/default
# cp /init/default-virtual-host /etc/nginx/conf.d/default.conf
# cp /init/default-mosz.com.tw /etc/nginx/conf.d/mosz.com.tw.conf
cp /init/default-one.mosz.com.tw /etc/nginx/conf.d/one.mosz.com.tw.conf

echo Setting up nginx root directory

[[ -d /var/www ]] || mkdir /var/www
cp /init/index.html /var/www/
chown -R www-data:www-data /var/www

sed -i 's/# server_names_hash_bucket_size 64;$/server_names_hash_bucket_size 64;/g' /etc/nginx/nginx.conf

