VPS Goodies

Permissions

chown-R www-data:www-data ../waterstreet          # Let apache be owner
sudo find . -type d -exec chmod 755 {} \;  # Change directory permissions rwxr-xr-x
sudo find . -type f -exec chmod 644 {} \; 

Create a new site

  1. create directory in /var/www
  2. new vhost file in /sites-available
  3. sudo apache2ctl graceful
  4. Add DNS entry in DO dashboard

Desktop > Server rsync -rvz -e ‘ssh -p 8746’ –progress zeltser saltcod@107.170.55.68:/var/www/zeltser

(entire folder) rsync -rvz -e ‘ssh -p 8746’ –progress zeltser saltcod@107.170.55.68:/var/www/zeltser (folder contens)

Server >Desktop rsync -avzu waterstr@thedrums.asmallorange.com:public_html/sudbury/wp-content  Desktop/ rsync -avzue ‘ssh -p 8746’ saltcod@107.170.55.68:/var/www/zeltser –progress Desktop/

Backup /var/www to Dropbox rsync -avzue ‘ssh -p 8746’ saltcod@107.170.55.68:/var/www/ –progress ../digitalocean-backup/

SSH without Password cat ~/.ssh/id_rsa.pub | ssh -p 8746 saltcod@107.170.55.68 ‘cat >> .ssh/authorized_keys’

or:  cat ~/.ssh/id_rsa.pub | ssh serverpilot@104.236.223.150 “mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys”
cat ~/.ssh/id_rsa.pub | ssh -p 8746 saltcod@23.92.22.244 “mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys”

Keep 2 folders in sync rsync -azr  –progress –delete master/ backup

Memory and Processes top — then Shift+o, then n watch -n 10 free -m — refresh every 10s

 

File Permissions

$ sudo chown -R www-data:www-data wp-content/


find . -type d -exec chmod 755{} \;  # rwxr-xr-x

find . -type f -exec chmod 644{} \;  # rw-r--r--

Delete folders older than 30 days

find . -atime +10 -type d -exec rm -r {} \;

 

# Symlink to a directory.

# from /new-site/themes:

ln -s /old-site/themes/waterstreet waterstreet-in-new-site