Home Setting Up a DigitalOcean Droplet as an Internet Hook
Post
Cancel

Setting Up a DigitalOcean Droplet as an Internet Hook

To establish a DigitalOcean droplet as an internet hook, follow these steps:

  1. Create your droplet with a name of your choice. In my case, I named it “mono.”

  2. Update the droplet by running the following commands:

1
2
apt update
apt upgrade
  1. Install and enable Nginx, as it will serve as the reverse proxy:
1
2
3
apt install nginx
systemctl enable nginx
systemctl status nginx
  1. Install Certbot for managing SSL certificates using SSH:
1
2
3
apt install certbot
apt install python3-certbot-dns-gandi
apt install python3-certbot-nginx
  1. From another host within my network, I set up an autossh connection to the droplet, and on the droplet, I deployed a Java application on port 8080.

  2. Verify the state and open ports of the droplet using the following command:

1
netstat -ntl
  1. Set up a virtual host in Nginx to forward traffic from port 80 to the Java application running on port 8080. Here’s an example configuration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Virtual Host 
#
server {
	server_name test.endeios.net;
	root /var/www/example.com;
	index /;
	
	location / {
	    proxy_pass        http://localhost:8080;
	    proxy_set_header  X-Real-IP $remote_addr;
	    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
	    proxy_set_header  Host $http_host;
	}
}
  1. Configure the DNS zone of your domain registered with Gandi to point to the droplet’s IP address.

  2. Finally, secure your website with Let’s Encrypt SSL certificates by running the Certbot command:

1
certbot -d test.endeios.net

Once completed, your application will be online, certified, and protected through SSH.

For more information on setting up a DigitalOcean droplet, refer to the official DigitalOcean documentation.

This post is licensed under CC BY-NC-SA 4.0 by the author.