Skip to content

Instantly share code, notes, and snippets.

@colkito
Forked from dominikwilkowski/README.md
Created November 25, 2016 14:19
Show Gist options
  • Select an option

  • Save colkito/41a7a357823d51f686236b4765f68243 to your computer and use it in GitHub Desktop.

Select an option

Save colkito/41a7a357823d51f686236b4765f68243 to your computer and use it in GitHub Desktop.
Ubuntu 16.04 setup with NGINX http/2 and letsencrypt

After creating the server (droplet on DigitalOcean) log in with

ssh root@[IP ADDRESS]

Once inside the machine set a password for root:

passwd

Update your package manager:

apt-get update
apt-get upgrade

Install fail2ban:

apt-get install fail2ban

Install vim:

apt-get install vim vim-scripts vim-doc vim-latexsuite vim-gui-common vim-gnome vim-gtk

Create a new user:

useradd deploy
mkdir /home/deploy
mkdir /home/deploy/.ssh
chmod 700 /home/deploy/.ssh

Add your ssh key:

vim /home/deploy/.ssh/authorized_keys         #add your public ssh key here, copy your ssh key with: pbcopy < ~/.ssh/id_rsa.pub
chmod 400 /home/deploy/.ssh/authorized_keys   #permissions
chown deploy:deploy /home/deploy -R           #permissions

Give the new user a sudo password:

passwd deploy

And add the user to the superuser group

visudo

Add into the file:

	root    ALL=(ALL) ALL
	deploy  ALL=(ALL) ALL

Disable root login and password authentication

vim /etc/ssh/sshd_config

Edit:

PermitRootLogin no
PasswordAuthentication no
AllowUsers deploy@(your-ip) deploy@(another-ip-if-any)

Restart the ssh service

service ssh restart

Now test your login with the new user in a new shell:

ssh deploy@[ID ADDRESS]
@cinghaman
Copy link
Copy Markdown

Hi do you have a guide like this for apache on digital ocean too, I created a 1 click WordPress app which sets up an ubuntu/apache.
I did manually update/add HTTP/2 support but my ssl/domain still shows HTTP/1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment