Update & Upgrade system/server
sudo apt -y update && sudo apt -y upgrade && sudo apt -y dist-upgrade
Reboot server
sudo shutdown -r now
Restart Apache
sudo service apache2 restart
Remove locally downloaded packages and apt-get caches
sudo apt autoremove && sudo apt clean
Add new user
sudo adduser new_user
Grant new user account with administrative privileges (sudo)
sudo usermod -a -G sudo new_user
SSH for new user (If you logged in to your root account using SSH keys, then password authentication is disabled for SSH. You will need to add a copy of your local public key to the new user.)
rsync --archive --chown=new_user:new_user ~/.ssh /home/new_user
Set timezone
sudo timedatectl set-timezone Europe/Berlin
Copy output to clipboard
<command with output> | pbcopy
Rename process
pm2 reload my_current_name --name my_new_name
sudo mkdir -p /var/www/example.com/html
sudo chown -R $USER:$USER /var/www/example.com/html
sudo chmod -R 755 /var/www
nano /var/www/example.com/html/index.html
sudo nano /etc/nginx/sites-available/example.com
(and paste/edit codeblock further down)sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo nano /etc/nginx/nginx.conf
server_names_hash_bucket_size 64;
<- uncomment line
sudo service nginx restart
server {
root /var/www/example.com/html;
index index.html index.htm;
server_name example.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:3000;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-nginx
sudo ufw allow 'Nginx Full'
sudo ufw delete allow 'Nginx HTTP'
sudo certbot --nginx -d example.com
sudo certbot renew --dry-run