Once you have installed Apache on your server you most likely need an easy way to edit or upload files. The root of Apache is /var/www Here is a way that i found the easiest and shortest. This work on Ubuntu 18.04 x64 and will work on previous versions… 16.04 and 17.04. You will need to have root priviledges for this.
Install vsftpd (ftp server)
sudo apt-get install vsftpd
Next youre going to need to do a small edit to the vsftpd config file, this can be done by using
sudo nano /etc/vsftpd.conf
Find the line that is
#write_enable=YES
and remove the # making it just
write_enable=YES
Then press ctrl + o
to save and ctrl + x
to exit nano
Now create a user and set users home directory to /var/www/
Note ftpusername is the username (it will ask you to set a password)
sudo adduser ftpusername
sudo usermod -d /var/www -m ftpusername
Lets now add the user to the www-data group permissons
sudo usermod -a -G www-data ftpusername
Set the permissons for /var/www
sudo chgrp -R www-data /var/www
sudo chmod -R g+w /var/www
Make all directories below /var/www owned by the www-data group too
sudo find /var/www -type d -exec chmod 2775 {} \;
Set the current file/s in /var/www to the group
sudo find /var/www -type f -exec chmod ug+rw {} \;
Finally restart vsftpd
service vsftpd restart
And you can now edit and uplaod files to the Apache root on your server.