What Is Port 8080 Used For and How Is It Applied?
What Is Port 8080?
Port 8080 is a widely used TCP port commonly associated with alternative HTTP web services. While the standard HTTP port is 80, developers and administrators frequently use 8080 for various purposes.
Primary Uses of Port 8080:
- Testing web servers without interfering with production services running on port 80.
- Running development environments and staging servers.
- Hosting web applications like Java Tomcat, Node.js services, or proxy servers.
- Administrative web interfaces for network tools and monitoring dashboards.
Why Use Port 8080 Instead of Port 80?
1. Privilege Requirements: On Unix/Linux systems, binding to ports 1-1024 (including port 80) requires root/admin privileges. Port 8080 can be used by non-root users, making it safer for development.
2. Multiple Services: It allows running multiple web services on the same machine (e.g., production on :80, testing on :8080).
3. Conflict Avoidance: Helps avoid conflicts with existing web servers or applications.
Common Applications Using Port 8080
| Application |
Purpose |
Typical Use Case |
| Apache/Nginx |
Web servers for hosting websites |
Development/staging servers, secondary web services |
| Tomcat |
Java-based application server |
Default port for many Tomcat installations |
| Node.js |
Hosting JavaScript backend services |
Development servers (Express.js, etc.) |
| Jenkins |
Continuous Integration (CI/CD) tool |
Web-based automation interface (often on :8080) |
| Squid Proxy |
Caching and forward proxy server |
Web proxy administration interface |
| Docker Containers |
Web applications in isolated environments |
Mapped container ports to host port 8080 |
| Grafana |
Web-based monitoring dashboards |
Alternative monitoring interface |
How to Use Port 8080 on Your Server
1. Check If Port 8080 Is Open and Accessible
First, verify if port 8080 is already in use and if it's reachable from outside your server.
Check local usage:
sudo ss -tlnp | grep :8080
# OR
sudo netstat -tlnp | grep :8080
Test remote connectivity (from another machine):
nc -zv yourserver.com 8080
# OR
telnet yourserver.com 8080
- If successful, the port is open and listening.
- If blocked, proceed to configure the firewall.
2. Allow Port 8080 in Your Firewall
If the port is blocked, open it in your system firewall.
On Ubuntu/Debian (UFW):
sudo ufw allow 8080/tcp
sudo ufw reload
sudo ufw status # Verify the rule
On CentOS/RHEL/Fedora (Firewalld):
sudo firewall-cmd --add-port=8080/tcp --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --list-ports # Check open ports
On cloud providers (AWS, Google Cloud, Azure):
- You must also configure the security group or firewall rules in your cloud console to allow inbound TCP traffic on port 8080.
3. Configure a Web Server to Use Port 8080
For Apache:
- Edit the main configuration or ports file:
sudo nano /etc/apache2/ports.conf # Ubuntu/Debian
# OR
sudo nano /etc/httpd/conf/httpd.conf # CentOS/RHEL
- Add or modify the
Listen directive:
Listen 8080
- In your virtual host configuration, ensure it's set to port 8080:
<VirtualHost *:8080>
- Restart Apache:
sudo systemctl restart apache2 # Ubuntu/Debian
# OR
sudo systemctl restart httpd # CentOS/RHEL
For Nginx:
- Edit your site configuration:
sudo nano /etc/nginx/sites-available/your-site
- Modify or add a server block:
server {
listen 8080;
server_name yourserver.com;
root /var/www/html;
index index.html index.php;
# Rest of your configuration...
}
- Test configuration and restart:
sudo nginx -t
sudo systemctl restart nginx
4. Access Your Web Service on Port 8080
Once configured, open a browser and navigate to:
http://yourserver.com:8080
# or
http://SERVER_IP_ADDRESS:8080
If you see your web page or application, port 8080 is working correctly.
How to Forward Port 8080 to Port 80
If you want users to access your service without specifying :8080 in the URL, you can forward traffic from port 80 to 8080.
Security Note: Ensure the service on port 8080 is properly secured before exposing it through port 80. Consider using HTTPS (port 443) for production sites.
Using iptables (Linux):
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
To make the rule persistent (on Ubuntu/Debian):
sudo apt-get install iptables-persistent -y
sudo netfilter-persistent save
Using Nginx as a Reverse Proxy (Recommended):
Create or modify an Nginx site configuration to proxy requests:
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
Summary
| Task |
Command / Action |
| Check if port 8080 is open |
nc -zv yourserver.com 8080 |
| Allow port 8080 in UFW (Ubuntu/Debian) |
sudo ufw allow 8080/tcp |
| Allow port 8080 in Firewalld (CentOS/RHEL) |
sudo firewall-cmd --add-port=8080/tcp --permanent |
| Configure Apache on port 8080 |
Add Listen 8080 in ports.conf or httpd.conf |
| Configure Nginx on port 8080 |
Modify server block: server { listen 8080; ... } |
| Test if port 8080 works |
Open http://yourserver.com:8080 in browser |
| Forward port 80 to 8080 |
Use iptables redirect or Nginx reverse proxy |
Final Tip: For production environments, consider setting up SSL/TLS (HTTPS) for services on port 8080. You can use Let's Encrypt with a tool like Certbot and configure your web server to listen on port 8443 or use a reverse proxy on port 443.
Now you understand what port 8080 is used for and how to configure it on your server for development, testing, and production purposes!
High-Availability Cloud VDS
- Uptime Р 99.95%
- Network bandwidth Р 1 Gb/s
- Technical support 24/7/365
learn more...