Update onion deployment

merge-requests/8/head
Bob Mottram 2020-10-19 23:47:42 +01:00
parent 475c23f1fb
commit 24c1b2401c
1 changed files with 16 additions and 0 deletions

View File

@ -229,6 +229,9 @@ fi
if [ ! -d ${web_dir}/cache ]; then
mkdir ${web_dir}/cache
fi
if [ ! -d /var/www/${ONION_DOMAIN}/htdocs ]; then
mkdir -p /var/www/${ONION_DOMAIN}/htdocs
fi
echo "Creating nginx virtual host for ${ONION_DOMAIN}"
{ echo "proxy_cache_path ${web_dir}/cache levels=1:2 keys_zone=my_cache:10m max_size=10g";
@ -252,6 +255,12 @@ echo "Creating nginx virtual host for ${ONION_DOMAIN}"
echo ' error_log /dev/null;';
echo '';
echo ' index index.html;';
echo '';
echo ' location /newsmirror {';
echo ' root /var/www/${ONION_DOMAIN}/htdocs;';
echo ' try_files $uri =404;';
echo ' }';
echo '';
echo ' location / {';
echo ' proxy_http_version 1.1;';
echo ' client_max_body_size 31M;';
@ -299,6 +308,13 @@ echo "Creating nginx virtual host for ${ONION_DOMAIN}"
echo ' }';
echo '}'; } > "/etc/nginx/sites-available/${username}"
chown -R www-data:www-data /var/www/${ONION_DOMAIN}/htdocs
if [ ! -d ${install_destination}/accounts/newsmirror ]; then
mkdir -p ${install_destination}/accounts/newsmirror
chown -R ${username}:${username} ${install_destination}
fi
ln -s ${install_destination}/newsmirror /var/www/${ONION_DOMAIN}/htdocs/newsmirror
ln -s "/etc/nginx/sites-available/${username}" /etc/nginx/sites-enabled/
systemctl restart nginx