Port 8080 is a versatile TCP port frequently used for web applications, development servers, reverse proxies, and alternative HTTP services. Configuring it correctly on your Virtual Private Server (VPS) is essential for hosting applications like Jenkins, Tomcat, Node.js services, or running a secondary web server.
Before configuring anything, check the current state of port 8080 from both inside and outside your VPS.
See if any service is already using port 8080:
If a service is listed (e.g., java, nginx), port 8080 is already in use. If there's no output, the port is free.
From your local computer, test if the port is accessible through the VPS's public firewall:
Interpretation:
Connection to YOUR_VPS_IP 8080 port [tcp/http-alt] succeeded!There are typically two layers of firewalls to configure on a VPS: the system firewall (UFW, firewalld, iptables) and the cloud provider's firewall (Security Groups, Firewall Rules).
Allow Port 8080 in UFW (Ubuntu/Debian):
You should see: 8080/tcp ALLOW IN Anywhere
Allow Port 8080 in Firewalld (CentOS/RHEL/AlmaLinux):
Most VPS providers (EraHost, AWS, DigitalOcean, Linode) have an external firewall that overrides your system firewall. You must configure it in your hosting control panel.
0.0.0.0/0 (all IPs) or a specific IP range.0.0.0.0/0 makes it publicly accessible to the entire internet. For administrative interfaces (like Jenkins), consider restricting the source IP to your office or home IP address (YOUR_IP/32).
Once the firewall is open, configure your application to listen on port 8080.
Listen directive exists for port 8080:
/etc/apache2/sites-available/000-default.conf):
<VirtualHost *:8080>
ServerAdmin admin@yourdomain.com
ServerName yourdomain.com
DocumentRoot /var/www/html
# ... other directives
</VirtualHost>
server {
listen 8080;
server_name yourdomain.com;
root /var/www/html;
index index.html index.php;
location / {
try_files $uri $uri/ =404;
}
# Additional configuration for PHP, etc.
}
For a quick test, you can run a temporary HTTP server:
This starts a basic server in the current directory, accessible on port 8080.
After configuration, verify everything works.
*:8080 or 0.0.0.0:8080.
HTTP/1.1 200 OK or similar.
http://YOUR_VPS_IP:8080 in a web browser. You should see your application or a default web page.If you want users to access your service on the standard HTTP port (80) but internally it runs on 8080, set up port forwarding.
To make this rule permanent on Ubuntu/Debian:
This is more flexible and allows SSL termination. Create an Nginx config listening on port 80:
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Now visitors to http://yourdomain.com will be served by the application on port 8080.
| Application | Configuration Note |
|---|---|
| Apache Tomcat | Edit /opt/tomcat/conf/server.xml, find the <Connector port="8080"> directive. |
| Jenkins | Set HTTP_PORT=8080 in /etc/default/jenkins or start with java -jar jenkins.war --httpPort=8080. |
| Node.js (Express) | In your app: app.listen(8080, '0.0.0.0'). |
| Docker Container | Run with: docker run -p 8080:80 image_name to map container port 80 to host port 8080. |
| Task | Command / Key Action |
|---|---|
| Check local port usage | sudo ss -tlnp | grep :8080 |
| Test external connectivity | nc -zv VPS_IP 8080 (from your local PC) |
| Allow port in UFW | sudo ufw allow 8080/tcp |
| Allow port in Firewalld | sudo firewall-cmd --add-port=8080/tcp --permanent |
| Configure Cloud Firewall | Most Important: Add inbound rule for TCP 8080 in your VPS provider's control panel. |
| Apache on port 8080 | Add Listen 8080 in ports.conf; configure virtual host for *:8080. |
| Nginx on port 8080 | Set listen 8080; in server block. |
| Test final access | Visit http://VPS_IP:8080 in a browser. |
| Forward port 80 to 8080 | Use iptables redirect or Nginx reverse proxy configuration. |
localhost:8080.
Your VPS is now correctly configured to use port 8080 for web applications, development servers, or any other service you choose to run.