Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

How to Use Port 8080 on a VPS: Complete Configuration Guide

6 min read
23.09.2025

Check If Port 8080 Is Open on Your VPS

Before configuring anything, check the current state of port 8080 from both inside and outside your VPS.

Port 8080 VPS Configuration
Port 8080 on VPS — app binds + firewall opens + optional 80→8080 NAT.

For closely related port / network-diagnostic topics, see What Is Port 8080 Used For?, How to Use portquiz.net to Test Port 8080, and https://localhost:110501 — Fix Invalid Port Error.

Check from Inside the VPS (Local Listening)

See if any service is already using port 8080:

sudo ss -tlnp | grep :8080
# OR
sudo netstat -tlnp | grep :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.

Check from Outside (Remote Connectivity)

From your local computer, test if the port is accessible through the VPS's public firewall:

nc -zv YOUR_VPS_PUBLIC_IP 8080

Interpretation:

  • Success: Connection to YOUR_VPS_IP 8080 port [tcp/http-alt] succeeded!
  • Failure (Connection refused): No service is listening, or the VPS's local firewall is blocking it.
  • Failure (Timeout): The cloud provider's network firewall (security group) is likely blocking the port.
Linux VDS
High performance for your projects
  • Root access and flexible setup
  • Control panel
  • NVMe disks
  • DDR5
Linux VDS

Open Port 8080 in the Firewall

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).

1. System Firewall Configuration

Allow Port 8080 in UFW (Ubuntu/Debian):

sudo ufw allow 8080/tcp
sudo ufw reload
sudo ufw status verbose # Verify rule

You should see: 8080/tcp ALLOW IN Anywhere

Allow Port 8080 in Firewalld (CentOS/RHEL/AlmaLinux):

sudo firewall-cmd --add-port=8080/tcp --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --list-ports # Check active ports

2. Cloud Provider Firewall (CRITICAL STEP)

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.

  • EraHost Cloud VDS: Navigate to your VPS management panel, find "Firewall Rules" or "Security Groups," and add an Inbound rule for TCP port 8080 from source 0.0.0.0/0 (all IPs) or a specific IP range.
  • General Process: Locate the firewall/network settings for your VPS, add a new rule for TCP port 8080, and apply it.
Security Note: Opening port 8080 to 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).

Run a Web Server on Port 8080

Once the firewall is open, configure your application to listen on port 8080.

Configure Apache to Use Port 8080

  1. Edit the ports configuration file:
    sudo nano /etc/apache2/ports.conf  # Ubuntu/Debian
    # OR
    sudo nano /etc/httpd/conf/httpd.conf  # CentOS/RHEL
  2. Ensure a Listen directive exists for port 8080:
    Listen 8080
  3. Configure a virtual host to use this port. Edit your site config (e.g., /etc/apache2/sites-available/000-default.conf):
    <VirtualHost *:8080>
        ServerAdmin admin@yourdomain.com
        ServerName yourdomain.com
        DocumentRoot /var/www/html
        # ... other directives
    </VirtualHost>
  4. Enable the configuration and restart:
    sudo a2ensite your-site-config  # If needed
    sudo systemctl restart apache2  # Ubuntu/Debian
    # OR
    sudo systemctl restart httpd    # CentOS/RHEL

Configure Nginx to Use Port 8080

  1. Edit your site configuration:
    sudo nano /etc/nginx/sites-available/your-site
  2. Modify or create a server block:
    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.
    }
  3. Test the configuration and restart:
    sudo nginx -t
    sudo systemctl restart nginx

Run a Simple Test Server (Python)

For a quick test, you can run a temporary HTTP server:

python3 -m http.server 8080 --bind 0.0.0.0

This starts a basic server in the current directory, accessible on port 8080.

Test Access to Port 8080

After configuration, verify everything works.

  1. Check local listening:
    sudo ss -tlnp | grep :8080
    You should see your service (nginx, apache, java, python) listening on *:8080 or 0.0.0.0:8080.
  2. Test from your local machine:
    curl -I http://YOUR_VPS_IP:8080
    A successful response shows HTTP/1.1 200 OK or similar.
  3. Access via browser: Open http://YOUR_VPS_IP:8080 in a web browser. You should see your application or a default web page.

Configure Port Forwarding (If Needed)

If you want users to access your service on the standard HTTP port (80) but internally it runs on 8080, set up port forwarding.

Using iptables (Simple Redirect)

sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

To make this rule permanent on Ubuntu/Debian:

sudo apt-get install iptables-persistent -y
sudo netfilter-persistent save

Using Nginx as a Reverse Proxy (Recommended)

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;
    }
}
sudo nginx -t
sudo systemctl restart nginx

Now visitors to http://yourdomain.com will be served by the application on port 8080.

Common Applications Using 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.

Summary

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.
Pro Tip for Production: For public-facing services on port 8080, always consider implementing SSL/TLS. You can run your application on 8080 and place an Nginx reverse proxy on port 443 that handles HTTPS termination and forwards requests to 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.

Frequently asked questions
Almost certainly. App is bound on 8080 locally, but firewall blocks incoming. Test from the same host: `curl localhost:8080` works locally. From outside: `curl http://your-vps-ip:8080` times out. Open firewall: UFW `ufw allow 8080/tcp`, iptables `iptables -A INPUT -p tcp --dport 8080 -j ACCEPT && iptables-save > /etc/iptables/rules.v4`.
App's config has `bind = 127.0.0.1:8080`. Change to `0.0.0.0:8080` to listen on all interfaces. After change, restart app, verify with `ss -tlnp | grep 8080` — should show 0.0.0.0:8080 instead of 127.0.0.1. Some apps explicitly require 0.0.0.0 (not `*`).
For production: reverse-proxy. Run nginx/Apache on 80/443 with TLS, proxy_pass to 127.0.0.1:8080. Get HTTPS, request logging, rate limiting for free. Direct exposure of 8080 is fine for dev/test but skips security and convenience layers.
AWS Security Groups, DigitalOcean firewalls, Hetzner Cloud firewalls operate at the cloud layer — separate from your VPS firewall. Both must allow the port. Check your cloud provider's network firewall UI for the relevant rule. UFW or iptables alone isn't enough on cloud VPSes.
Related articles
PrestaShop IMAP Configuration Error: Troubleshooting Guide
How to Use portquiz.net to Test Port 8080
What Is clientconfig.microsoftonline-p.net? Complete Setup Guide