Open Port 8080 in DigitalOcean Droplet • ServerHealers

 DigitalOcean is a unique and straightforward cloud hosting provider. DigitalOcean offers cloud computing services to customers to deploy and develop applications that need to be run across multiple cloud servers. DigitalOcean Infrastructure is one of the leading cloud service providers based in the USA. Even though the headquarters of DigitalOcean is located in New York City, their data centers are prevalent in every corner of the world to offer seamless cloud services across the globe. In addition, DigitalOcean provides a simple interface and set-up along with a very affordable price.DigitalOcean is a cloud hosting provider that offers Virtual Private Servers as droplets. DigitalOcean droplets is a VPS (Virtual Private Server) hosted on the DigitalOcean cloud. DigitalOcean droplet is a jargon coined for a network of servers. Droplets are Linux-based virtual machines that run on top of virtualized hardware, and each Droplet that a user deploys is considered a new server that they can use. DigitalOcean Droplet can be used either in a standalone or as part of a more extensive, cloud-based infrastructure.Hosting applications like Jenkins, Tomcat, etc., will require the user’s DigitalOcean Droplet to allow connections on port 8080. In order to allow these connections, the user needs to modify the Droplet firewall. Sometimes, even after firewall changes, the application can fail due to improper firewall setup. This tutorial explains the steps to open port 8080 in DigitalOcean Droplets and fix common errors while opening port 8080. Methods to Open Port 8080 in DropletIn DigitalOcean Droplets, installing standard services, such as mail server, web server, etc., does not need further firewall modifications. That means when the service starts, users can connect to port 25, port 80, etc. But that is not the case with custom ports, such as 8080. Users need to open these ports in the DigitalOecan Droplets firewall.Firewall modifications are really critical and require experience. Any bad firewall rules can mess up the working of the entire server. >> Note: Making DigitalOcean applications or services network ports public is a significant security risk. We strongly advise only allowing access to those ports from trusted networks. Suppose users need to access applications outside of a trusted network for development purposes, do not allow access to those ports using a public IP address. Instead, use a reliable and secure channel such as an SSH tunnel or a VPN. Open Port 8080 using UFWAll DigitalOcean Droplets typically come with a firewall tool called Uncomplicated Firewall or UFW. In order to open port 8080 using UFW, follow the below steps: Before adding the firewall rule, first confirm that UFW is active by checking its status. In order to check the status of UFW, execute the following command: # ufw status If UFW is active, the output of the above command should look similar to the one shown below: root@ubuntu-s-user-01:~# ufw status
Status: active In order to open port 8080 in Digital Droplet using UFW, execute the following command: # ufw allow 8080 If the port was opened successfully, the output of the above command would look similar to the one shown below: root@ubuntu-s-user-01:~# ufw allow 8080
Rule added
Rule added (v6)  Finally, execute the following command to view the added rule in the list: root@ubuntu-s-user -01:~# ufw status
Status: active
To Action From
— —— —-
22 ALLOW Anywhere
8080 ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
8080 (v6) ALLOW Anywhere (v6)  Open Port 8080 using Command Line Interface (CLI)Similar to the UFW method, users often use command-line utilities to add the firewall rules in the DigitalOcean Droplets. In order to add firewall rules, execute the following command: # iptables -I INPUT 1 -i eth0 -p tcp –dport <port number> -j ACCEPT In order to open port 8080 in Droplets, execute the following command: # iptables -I INPUT 1 -i eth0 -p tcp –dport 8080 -j ACCEPT The above command will open up port 8080 on the DigitalOcean server. Common Issues While Opening Port 8080Although the process of opening port 8080 in Droplets looks effortless, we often get requests from clients about the failure of applications on port 8080. Some of the common errors while opening port 8080 are: 1. Application Not Showing in the Web BrowserAnother common issue is that applications do not show up in the web browser. For example, the Tomcat application pages show a timeout error while loading.In this case, check and confirm if the process is running on port 8080 by executing the following command: # netstat -plan | grep :8080 Some other programs may be using that port which could have caused the Tomcat service to fail.In order to fix it, check the alternate processes and kill those that should not be running. After that, restart the Tomcat service, and the application will load correctly. 2. Server IP Not ListeningSometimes, even after adding a firewall rule, the server IP address may not listen to port 8080. In that case, we need to check the firewall rules and confirm that the rules are added precisely. Often, the Listen directive of the application will only have a localhost interface in it.Therefore, edit the Listen entry of the application configuration file and replace 127.0.0.1 with 0.0.0.0  to fix this issue. Now, the primary IP address will also start listening to port 8080.Again, we can confirm this by executing the telnet command. On successful connection on the primary server IP 165.xx.1×6.65, the results look similar to the one shown below: # telnet 165.xx.1×6.65 8080
Trying 165.xx.1×6.65…
Connected to 165.xx.1×6.65.
Escape character is ‘^]’. 3. Cannot Connect to Port 8080Even when the service configuration, firewall rules, etc., are correctly added in the Droplet, customers can have problems with the port 8080 connection. The most common reason for this will be firewall restrictions on the user’s system.In that case, isolate the problem by checking the connection from an alternate location. When the connection works from a new location,  it clearly indicates that the problem is at the user’s end. Therefore, ask the customer to tweak their home network firewall. ConclusionThis tutorial presents the steps to open port 8080 in DigitalOcean Droplets and fix common errors while opening port 8080. Hope this tutorial was helpful, and do reach out to us if you have any queries or suggestions.

Related articles

Latest articles