mkdir /var/www/website.com
chown $SAFEUSER:$SAFEUSER /var/www/website.com
export SAFEUSER=yourname (if $SAFEUSER is not set)
This is where you keep the contents of your website.
Inside here should exist a public_html directory that will be what apache searches for.
sudo cp /etc/apache2/sites-available/defaultsite.conf /etc/apache2/sites-available/website.com.conf
(this assumes you have a defaultsite.conf script. use the one below if not.)
vim /etc/apache2/sites-available/website.com.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName website.com
ServerAlias www.website.com
DocumentRoot /var/www/website.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
The VirtualHost is saying that we'll be looking for things based on their names when a request hits our server.
The server name and aliases are matched against this file and then redirected to the contents of DocumentRoot.
sudo a2ensite website.com.conf (sudo a2dissite website.com.conf)
sudo systemctl restart apache2
(later on, as $SAFEUSER, do )
mkdir /var/www/website.com/public_html
cd /var/www/website.com/
source activate py3
ivy init
ivy build
vim xfer_files.sh
into which you will paste
#!/bin/bash
source activate py3
# rm -rf var/www/website.com/public_html/*
cd /var/www/website.com/
rm -rf out/*
ivy build
cp -r out/* public_html/
# git commit -am 'rebuilt.'
# git push origin master
Uncomment the bottom two lines once you initialize a git repository in the /var/www/website.com/ directory and set an appropriate remote origin address.
You could alternatively clone a git repo, in which case it would be helpful to add the SAFEUSER as owner of the whole /var/www directory altogether and let them make sites in there.
Save this file and make it executable with chmod +x xfer_files.sh.
Once you do this you can now just run ./xfer_files.sh from the command line to update your site. The changes will be visible immediately.
adding a user:
sudo useradd -m michaelsudo passwd michael