Hosting applications like Tomcat, Jenkins, etc. will require your DigitalOcean Droplet to allow connections on port 8080.
This requires Droplet firewall modification. At times, even after changes in firewall, the application can fail due to improper firewall set up.
At Bobcares, we help cloud server owners to configure the firewall as part of our Managed Cloud Services.
Today, we’ll see how we open port 8080 on the Droplet, common errors along with their fixes.
How to open port 8080 in Droplet?
In DigitalOcean Droplets, installing common services like web server, mail server, etc. do not need further firewall changes. That means, when the service starts, we can connect to port 80, port 25, etc.
But, that is not the case with custom ports like 8080. They need to be opened in firewall.
Firewall modifications are really critical. Any bad firewall rules can mess up the working of the entire server.
Now, let’s see how our Cloud Specialists open up the port 8080.
1. Using UFW
All DigitalOcean Droplets usually come with a firewall tool called UFW, or Uncomplicated Firewall. We’ll first see the steps to open port using UFW.
Here, before adding the rule, we first confirm that UFW is active. To see the status, we use :
ufw status
When it is active, the result looks like
root@ubuntu-s-uno-01:~# ufw status
Status: active
Now, we can open port 8080 by the command
ufw allow 8080
The output on successful addition of rule will look like:
root@ubuntu-s-uno-01:~# ufw allow 8080
Rule added
Rule added (v6)
And, it shows in the rule list as:
root@ubuntu-s-uno-01:~# ufw status
Status: active
To Action From
-- ------ ----
22 ALLOW Anywhere
8080 ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
8080 (v6) ALLOW Anywhere (v6)
2. Using command-line
Similarly, we often use command-line utilities to add the firewall rules in the Droplets. For this, we use the command,
iptables -I INPUT 1 -i eth0 -p tcp --dport 8080 -j ACCEPT
This opens up the port 8080 on the server.
Common errors while opening port 8080
Although, the process of opening port 8080 looks really easy, we often get requests from customers about failure of apps on port 8080.
Let’s now have a look at the top errors that we see.
1. Server IP not listening
At times, even after adding firewall rule, the server IP may not listen on port 8080.
Here, our Support Engineers check the firewall rules and confirm that rules are added correctly. Often, the “Listen” directive of the application will have only localhost interface in it.
Therefore, to fix the problem, we edit the Listen entry of the application config file and replace ‘127.0.0.1’ as ‘0.0.0.0’. Now, the main IP also starts listening.
Again, we confirm this by telnet command. On successful connection on main server IP 165.xx.1×6.65, the results look like:
$ telnet 165.xx.1x6.65 8080
Trying 165.xx.1x6.65...
Connected to 165.xx.1x6.65.
Escape character is '^]'.
2. Application not showing in browser
Another common problem is that application do not show up in the browser. For example, the Tomcat application pages shows timeout error.
In this case, our Cloud Engineers first check and confirm the process running on port 8080 using the command,
netstat -plan | grep :8080
Usually, some other program will be using that port. And, this causes Tomcat service to fail.
To fix, we check the alternate processes and kill those that shouldn’t be running. Then, we restart Tomcat service and the pages show up correctly.
3. Cannot connect on 8080
Even when the firewall rules, service configuration, etc. are correct, customers can have problems with port 8080 connection.
Most common reason for this will be firewall restrictions at user’s computer.
Here, we isolate the problem by checking the connection from an alternate location. When connection works from a new location, it clearly indicates that problem is at user’s side. Therefore, we suggest customers to tweak their home network firewall.
[Is application on your Droplet not working ? We can make it work on port 8080.]
Conclusion
The process to open port 8080 in DigitalOcean Droplet is rather easy. However, bad firewall rules can affect connectivity to the server. Today, we saw how our Cloud Engineers open the port and correct the common problems with port 8080 connectivity.
0 Comments