, 4 min, 702 words
Here was an hour of fun! It felt time to migrate to a new server, to ring in the new (static) site and make sure I fully understand the configuration. Why do this?
So, a bit of setup. I had an html directory ready to go that I'd tested locally with zola. All I needed was a place to put it and the configuration necessary to view those files via a website.
@
and *
, I still have apps.wxyzeph.com
running on django on my old memory-crunched server.)~/.ssh/config
to make my life easier)apt-get install zsh
, then edit /etc/passwd
to point to
zsh instead of bash, which circumvents chsh
requiring a password,
which is less secure than my ssh-key-only setup.)/etc/hosts
and
/etc/hostname
, then likely a restart, since service restart hostname
is saying there's no such service.apt-get update
, then apt-get upgrade
to bring things up to date.apt-get install apache2
/var/www/wxyzeph/html
(and logs) directory, set DocumentRoot to
there, and edit the Error/AccessLog destinations. (Note: should
also set ServerName, or you may get an error AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.10.0.5. Set the 'ServerName' directive globally to suppress this message
– Digital
Ocean
suggests adding ServerName: 127.0.0.1
to
/etc/apache2/apache2.conf
) Copy existing
var/www/html/index.html
into your html directory./var/www
. Based on this askubuntu
answer
it seems the best plan is for /var/www
to be root:root
and for
stuff within it to be owned by the user who will edit it, and
www-data
should only have any ownership over files it must be
able to write to.zeph
and set up their ssh access. The rest of this
work should probably be done by non-root.
adduser zeph
(make sure to save their password somewhere!)ssh-keygen
to generate a keypair to use for this new user/home/zeph/.ssh/authorized_keys
(and ensure that file is owned by zeph rather than root!)ssh zeph@wxyzeph.com -i /path/to/private/key
rsync -avz public/ wxyzeph:/var/www/wxyzeph/html
)apt-get install certbot
apt-get install python3-certbot-apache
certbot --apache