To establish a DigitalOcean droplet as an internet hook, follow these steps:
-
Create your droplet with a name of your choice. In my case, I named it “mono.”
-
Update the droplet by running the following commands:
1
2
apt update
apt upgrade
- Install and enable Nginx, as it will serve as the reverse proxy:
1
2
3
apt install nginx
systemctl enable nginx
systemctl status nginx
- 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
-
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.
-
Verify the state and open ports of the droplet using the following command:
1
netstat -ntl
- 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;
}
}
-
Configure the DNS zone of your domain registered with Gandi to point to the droplet’s IP address.
-
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.