To run an Ubuntu website on port 8080, configure the web server to listen on TCP 8080, make the site’s virtual-host or server-block declaration use that port, allow TCP 8080 through UFW and any cloud or router firewall, then test locally and from another network. Visitors must use a URL such as http://example.com:8080/; DNS still resolves the hostname, while the explicit port selects the web listener.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
The procedure differs slightly between Apache2 and nginx, but the rule is the same: the service listener, site configuration, and every network firewall between the client and server must agree on one port.
As an Amazon Associate I earn from qualifying purchases.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →What a non-standard HTTP port changes
HTTP normally uses TCP port 80. HTTPS normally uses TCP port 443. A non-standard HTTP port is any other TCP port, such as 8080, 8000, 8081 or 3000. Changing the port does not change the HTTP protocol or your domain name. It changes only where the operating system expects the web service to accept connections.
A browser will not assume a custom port. The port must appear after the hostname, separated by a colon:
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
http://example.com:8080/
If a visitor enters http://example.com/, the browser tries port 80 instead. If nothing is listening there, the request fails or reaches a different service. DNS records map a name to an address; they do not select a TCP port.
Port 8080 is often used for development, staging, administration interfaces and applications behind a reverse proxy. It is not a security mechanism. Plain HTTP on 8080 is still unencrypted, and anyone able to observe the connection can read or alter traffic. For a public production site, use HTTPS with a certificate and make the HTTP-to-HTTPS behavior explicit.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsPrepare the Ubuntu server
Choose a port and check for conflicts
Use a TCP port that your application and hosting provider permit. Before changing a service, check whether another process already owns it:
sudo ss -ltnp
The output shows listening TCP sockets, local addresses, ports and, where available, the owning process. Look for an entry containing the port you plan to use, such as :8080. If it is already bound, either choose another unused port or reconfigure the process that owns it. Two services cannot normally bind the same address and port.
Record the current configuration
Identify whether the server runs Apache2, nginx or both. Keeping a copy of the files you change makes rollback straightforward:
sudo cp /etc/apache2/ports.conf /etc/apache2/ports.conf.bak
Only run the Apache backup command when Apache2 is installed. For nginx, copy the relevant file under /etc/nginx/sites-available/ before editing it. You need root privileges to change these files and reload the services.
Free tools Windows power users keep installed
One-click scans. No signup required.
Run Apache2 on a custom port
1. Set Apache2’s listening port
Apache2’s primary port setting is /etc/apache2/ports.conf. The Listen directive specifies the port and can optionally specify an IP address. The default installation commonly contains Listen 80. Change it to the chosen port or add a second listener:
Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
sudo nano /etc/apache2/ports.conf
Listen 8080
If you leave Listen 80 in place, Apache2 will continue listening on port 80 as well. Remove it only if no other site or redirect needs port 80. If Apache is bound to a particular address, preserve that intent with a matching form such as Listen 192.0.2.10:8080; an address-specific listener will not accept connections sent to another local address.
2. Match the virtual host to the same port
Apache chooses a virtual host using the request’s address, port and host name. Open the site configuration in /etc/apache2/sites-available/ and change its opening declaration from port 80 to port 8080:
<VirtualHost *:8080>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example
<Directory /var/www/example>
Require all granted
</Directory>
</VirtualHost>
Keep ServerName and any required ServerAlias values appropriate for the site. A listener on 8080 with a virtual host still declared as *:80 can produce the wrong site, a default-host response or a configuration error. When several sites share Apache2, give each site the correct port and host-name combination.
3. Validate and apply the change
Validate the configuration before reloading the service:
sudo apachectl configtest
Proceed only when Apache reports a successful syntax check. Then reload Apache2 so existing connections are handled without an unnecessary stop:
sudo systemctl reload apache2
If the reload fails, inspect the service status and journal, correct the reported file or directive, run the syntax test again and retry. A full restart is not a substitute for fixing a syntax error; it can also interrupt active requests.
4. Confirm Apache’s listener
Check the socket table again:
sudo ss -ltnp | grep ':8080'
You should see Apache’s process listening on the expected address. A listener shown only on 127.0.0.1:8080 accepts local requests but not connections arriving through the server’s network address. If the site must be public, configure Apache to listen on the appropriate interface, commonly with *:8080, while observing your host’s IPv4 and IPv6 setup.
Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
Run nginx on a custom port
1. Edit the relevant server block
nginx selects a site using the listen and server_name directives in a server block. Open the enabled site configuration, commonly linked from /etc/nginx/sites-enabled/:
sudo nano /etc/nginx/sites-available/example
Change the listener to the chosen port:
server {
listen 8080;
listen [::]:8080;
server_name example.com www.example.com;
root /var/www/example;
index index.html index.htm;
}
The IPv6 line is needed when the site should accept IPv6 connections. If your server deliberately has no IPv6 service, do not add an IPv6 listener merely for appearance; make the address plan intentional. When multiple nginx sites are enabled, each needs an appropriate, distinct listener and a correct server_name so requests on 8080 are matched to the intended block.
2. Test and reload nginx
Run nginx’s configuration test before applying changes:
sudo nginx -t
Only reload after a successful test:
sudo systemctl reload nginx
Then verify the socket:
sudo ss -ltnp | grep ':8080'
If nginx was already listening on another port for an HTTPS site, leave that listener in place unless you intentionally want to remove it. A custom HTTP listener does not automatically create an HTTPS listener or certificate configuration.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchOpen the port in UFW
Ubuntu commonly uses Uncomplicated Firewall (UFW) as its firewall frontend. Allow the same TCP port that the web service uses:
sudo ufw allow 8080/tcp
Preview the rule before changing the firewall:
sudo ufw --dry-run allow 8080/tcp
Inspect the active rules afterward:
sudo ufw status
The protocol matters. An HTTP listener uses TCP, so an unrelated UDP rule does not permit web requests. If you later remove the listener, remove the corresponding rule deliberately rather than leaving an unused exposed port:
sudo ufw delete allow 8080/tcp
Do not disable UFW wholesale to troubleshoot one port. Also ensure your SSH access rule remains present before changing firewall policy; locking yourself out can require console access from your hosting provider.
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
Permit the port outside the Ubuntu host
UFW is only one possible filtering layer. A cloud virtual machine may have a provider security group, network ACL or perimeter firewall. A home or office server may sit behind a router performing network address translation (NAT).
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Cloud security groups
Add an inbound rule for TCP 8080 in the provider’s security group or firewall attached to the server. Restrict the source range when the site is private; use the smallest set of addresses that needs access. The rule must target the same instance or network interface that owns the public address.
Router NAT and port forwarding
For a server behind a router, create a TCP port-forwarding rule from the router’s public port 8080 to the Ubuntu machine’s private address and port 8080. Give the machine a stable DHCP lease or static private address so the forwarding rule does not become stale. Test from a network outside the home or office; testing from inside may be affected by the router’s hairpin-NAT behavior.
Provider and upstream restrictions
Some networks filter uncommon outbound or inbound ports. If UFW and the service are correct but remote connections still time out, check the provider’s policy and any upstream firewall. A port can be open locally while unreachable from the public internet.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Test in the right order
Testing from the server outward isolates configuration errors from network filtering. Use the loopback address first:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
curl -I http://127.0.0.1:8080
A response such as HTTP/1.1 200 OK, a deliberate redirect, or an application-specific status proves that a web process answered locally. It does not prove that the public route works.
Next test the server’s LAN address from another machine on the same network, if applicable. Finally test from an external connection using the public DNS name and explicit port:
Best Value
curl -I http://public-name.example:8080
Use a browser with the same URL when you need to inspect rendered content. If the hostname resolves to several addresses, test each address family separately when diagnosing IPv4 and IPv6 differences. A successful local request followed by a failed remote request usually indicates UFW, a cloud security group, router NAT or an upstream block rather than an Apache or nginx document-root problem.
Understand common failures
| Symptom | Likely cause | What to check |
|---|---|---|
| Connection refused | No process is listening on the requested address and port, or a firewall is actively rejecting it. | Run ss -ltnp; verify the service reload succeeded; check that the listener is not limited to loopback; inspect UFW and perimeter rules. |
| Connection times out | A firewall, security group, router or upstream network is silently dropping packets. | Compare a local curl with an external curl; confirm the cloud or NAT rule and the server’s public address. |
| Local curl works, public request fails | The application is healthy but traffic is blocked or routed incorrectly outside the host. | Review UFW, provider rules, router forwarding, DNS records and IPv4/IPv6 paths. |
| 404 Not Found or the wrong website | The port is reachable, but virtual-host or server-block matching selects a different site, or the document root lacks the requested path. | Check Apache’s <VirtualHost *:8080> and ServerName, or nginx’s listen, server_name and root. |
| Apache or nginx will not reload | A syntax error, duplicate listener or invalid path prevents the configuration from loading. | Run apachectl configtest or nginx -t and fix the exact reported line before retrying. |
| IPv4 works but IPv6 fails | Only an IPv4 listener or firewall rule exists, or DNS publishes an IPv6 address without a working route. | Check the [::]:8080 listener, IPv6 UFW policy, provider rules and the server’s IPv6 address. |
Keep HTTPS and redirects explicit
Moving a site from port 80 to 8080 does not provide encryption. If you need HTTPS on a custom port, configure a separate TLS listener, certificate and firewall rule for that port, and use an https:// URL with the port included when it is not 443. A certificate does not automatically follow a service from port 80 to another listener.
Recommended Free Tools
Redirects also need deliberate design. An HTTP request on 8080 can redirect to an HTTPS URL on 443, but the application or web-server rule must name the correct destination. Conversely, leaving a port-80 redirect in place does not make requests to 8080 redirect automatically. Test both the original URL and the destination so you do not create a loop between custom HTTP and HTTPS listeners.
Security considerations for an exposed port
Ubuntu security guidance defines an open port as a network port bound to a service and actively listening for incoming connections or packets. Exposing an open port on an untrusted network creates risk when the listening software is vulnerable or misconfigured.
- Expose only the port and protocol that the application needs.
- Keep Apache2, nginx, the operating system and the application patched.
- Use a restricted source range for administrative or staging sites instead of allowing the entire internet.
- Prefer HTTPS for credentials, sessions and other sensitive data.
- Review access logs after opening the port; an uncommon number does not make a service invisible.
- Remove the UFW, security-group and NAT rules when the site is retired.
Binding a development service to 127.0.0.1 is safer when only local access is required. Binding to all interfaces makes it reachable wherever the surrounding firewalls permit it, so choose the address deliberately.
Apache2 and nginx: which setting controls the port?
| Axis | Apache2 | nginx |
|---|---|---|
| Primary port directive | Listen in /etc/apache2/ports.conf |
listen in a server block |
| Site matching | Virtual-host declaration, with optional ServerName and aliases |
server_name combined with the selected listen socket |
| Apply a change | Run apachectl configtest, then reload Apache2 |
Run nginx -t, then reload nginx |
| Typical role | General-purpose web server with per-site virtual hosts | Web server and reverse proxy using server blocks |
The firewall and external-network steps are the same for either server. The important distinction is where the listener is declared and how the site is selected after a connection reaches that listener.
Rollback and maintenance
If the custom port causes an outage, restore the previous listener and site declaration, validate, reload and then remove only the firewall rules that are no longer needed. For Apache2, restore the prior Listen and <VirtualHost> values. For nginx, restore the former listen lines. Confirm the old port with ss -ltnp and test it with curl before changing external DNS or router rules.
Document the final port in your deployment notes, monitoring checks and runbooks. Monitoring that checks only port 80 will report a healthy server as down when the site intentionally runs on 8080. Likewise, bookmark the full URL with its port so administrators do not accidentally test a different service.
Quick Recap
Final checklist
- Choose an unused TCP port and confirm it with
ss -ltnp. - Configure Apache2’s
Listenand matching virtual host, or nginx’slistenand server block. - Run the appropriate configuration test before reloading the service.
- Verify the process is listening on the intended IPv4 and, if used, IPv6 addresses.
- Allow the exact TCP port in UFW, checking the rule with
ufw status. - Permit the port in the cloud security group or router NAT rule when another network boundary exists.
- Test
http://127.0.0.1:8080, then the public hostname and port from an external network. - Use HTTPS deliberately for production traffic and remove unused exposure when the site is no longer needed.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




