What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Yes, Nginx and Apache can run on the same server when they do not bind the same IP address and TCP port. To put Nginx on port 8080, configure listen 8080; (or listen 127.0.0.1:8080;) in an Nginx server block, then move Apache to another unused endpoint such as 127.0.0.1:8081. If Nginx is the public front end, a more common arrangement is Nginx on ports 80/443 and Apache on a private loopback port such as 8080, with Nginx forwarding requests using proxy_pass.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
Why the two services cannot share one port
A listening socket is identified by an IP address and a TCP port. Only one process can normally claim a particular address-and-port pair. If Apache already owns 0.0.0.0:8080, Nginx cannot also bind 0.0.0.0:8080; the second service will fail with an “Address already in use” error.
As an Amazon Associate I earn from qualifying purchases.
Recommended Free Tools
The solution is to assign distinct endpoints. The address matters as well as the port: 127.0.0.1:8080 and a public address on port 8080 are different bindings, provided no wildcard listener already covers both. A listener without an explicit address, such as listen 8080;, normally accepts connections on all local addresses. Adding 127.0.0.1: restricts it to connections originating on the server itself.
Choose the layout before editing files
Decide which daemon should be reachable by clients and which one should process the application. The right arrangement depends on whether Nginx is serving files itself or acting only as a reverse proxy.
#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.
| Layout | Public endpoint | Backend endpoint | Typical use | Exposure and TLS |
|---|---|---|---|---|
| Nginx on 8080, separate Apache site | Nginx on :8080 |
Apache on another port, for example 127.0.0.1:8081 |
Two independently configured sites or a requirement that Nginx specifically accept port 8080 | Both daemons can serve different content; Apache can be loopback-only |
| Nginx front end, Apache backend | Nginx on ports 80 and/or 443 | Apache on 127.0.0.1:8080 (or another private port) |
Nginx handles the public connection and forwards dynamic or legacy application requests to Apache | Nginx commonly terminates TLS; Apache is not directly reachable from the network |
| Nginx on 8080 as a proxy | Nginx on :8080 |
Apache on 127.0.0.1:8081 or another free port |
A nonstandard public port is required while Nginx remains the front end | Clients must include :8080 in the URL unless another proxy or firewall mapping is used |
Do not configure both services for the same wildcard address and port. Also decide whether Apache should be reachable directly. If Nginx is the only intended entry point, bind Apache to loopback so external clients cannot bypass Nginx.
Inspect listeners and select free endpoints
Make a record of current listeners before changing configuration. On a Linux host, this command displays TCP sockets and the owning process when run with sufficient privileges:
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →sudo ss -ltnp
Look specifically for ports 80, 443, and 8080, and note whether each process is bound to all addresses or only to loopback. You can also inspect service state with:
sudo systemctl status nginx
sudo systemctl status apache2
The service name can differ outside Debian- and Ubuntu-based systems. Choose an address-and-port pair that is not already listed. For an Apache backend that only Nginx will use, a loopback binding such as 127.0.0.1:8081 is safer than a public binding.
- External Nginx on 8080: use
listen 8080;when clients must connect through any local interface, orlisten 127.0.0.1:8080;when another local proxy is the only caller. - Private Apache backend: use an unused loopback port and make every Apache virtual-host declaration match it.
- Existing service on 8080: either move that service or select another port; adding a second listener with the same endpoint will not work.
Layout A: Nginx accepts port 8080 and Apache uses another port
Use this layout when the requirement is specifically that Nginx listen on 8080. The example keeps Apache on loopback port 8081, so Apache is available to local processes and Nginx but is not directly exposed on the network.
1. Move Apache to 127.0.0.1:8081
On Ubuntu, Apache’s listening ports are defined in /etc/apache2/ports.conf. Change the relevant directive to:
Outdated 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 matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallRank #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.
Listen 127.0.0.1:8081
Then update every enabled virtual host that still refers to the old endpoint. A site file under /etc/apache2/sites-available/ can contain:
<VirtualHost 127.0.0.1:8081>
ServerName example.com
DocumentRoot /var/www/apache-site
<Directory /var/www/apache-site>
Require all granted
</Directory>
</VirtualHost>
The exact site filename and directory layout vary by distribution. The important part is consistency: Apache’s Listen directive and each enabled <VirtualHost> declaration must name the same address and port. Leaving one virtual host on the old port can produce startup errors or cause requests to land in an unintended site.
2. Configure Nginx on 8080
Create or edit the appropriate Nginx server block. For a site served directly by Nginx:
server {
listen 8080;
server_name example.com;
root /var/www/example;
index index.html;
}
That block serves files from /var/www/example; it does not send requests to Apache. If Nginx should instead proxy requests to the Apache site on 8081, use a location block such as:
server {
listen 8080;
server_name example.com;
location / {
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;
proxy_pass http://127.0.0.1:8081;
}
}
Here Nginx owns the client-facing port and Apache handles the proxied request. Apache remains private because it listens only on loopback.
3. Enable the site and test both daemons
On Ubuntu, enable the Apache site if necessary, then test configuration before reloading:
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
sudo apachectl configtest
sudo nginx -t
Only proceed when both tests report valid configuration. Reload rather than stopping the service so existing connections have a chance to complete:
sudo systemctl reload apache2
sudo systemctl reload nginx
Request the exact public URL, including the port:
curl -I http://example.com:8080/
If the Nginx block is loopback-only, test from the server itself and use the local address explicitly:
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorscurl -I http://127.0.0.1:8080/
Layout B: Nginx is the public reverse proxy and Apache is the backend
For a normal public website, it is often simpler to keep Nginx on ports 80 and 443 and move Apache to a private port. Apache then handles the application while Nginx controls the public connection, static-file policy, and (when configured) TLS termination.
1. Put Apache on a private port
Set Apache’s Ubuntu port configuration to a loopback endpoint, for example:
Listen 127.0.0.1:8080
Match it in the virtual host:
<VirtualHost 127.0.0.1:8080>
ServerName example.com
DocumentRoot /var/www/apache-app
<Directory /var/www/apache-app>
Require all granted
</Directory>
</VirtualHost>
If another process already uses 8080, select a different free loopback port and use that number consistently in both Apache and Nginx.
2. Forward requests from Nginx
Configure the public Nginx server block as follows:
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.
server {
listen 80;
server_name example.com;
location / {
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;
proxy_pass http://127.0.0.1:8080;
}
}
The proxy_pass directive is placed inside location and includes the backend port. The forwarding headers preserve the original host, client address, proxy chain, and request scheme for applications that need them. Use the same pattern in the TLS server block when Nginx accepts HTTPS.
Apache should not be assigned a public listener merely because Nginx is proxying it. A loopback binding prevents a client from bypassing Nginx’s access rules and reaching the backend directly.
3. Decide where TLS terminates
If Nginx terminates TLS, the client connects securely to Nginx and Nginx forwards to Apache over the local connection. The X-Forwarded-Proto value tells the application that the original request used HTTPS, which helps it generate secure redirects and links. If Apache terminates TLS instead, Nginx must forward the encrypted connection or use a separate design; do not assume that an HTTP backend automatically knows the client’s original scheme.
Whichever daemon generates redirects must be configured with the public hostname and scheme. Otherwise an application can redirect users to an internal address or to the backend port, such as :8080 or :8081, instead of the public URL.
Make virtual-host selection deterministic
Nginx chooses a server block first by the listening address and port, then by matching the request’s Host header against server_name. If no name matches, Nginx uses the default server for that address-and-port pair. Give each site a unique name and avoid assigning default_server to more than one block on the same listener.
For example, these are separate namespaces:
server {
listen 8080;
server_name example.com;
}
server {
listen 8080;
server_name api.example.com;
}
A request to http://example.com:8080/ and one to http://api.example.com:8080/ can therefore reach different blocks. A request made by IP address, or with an unrecognized host name, may be handled by the default block instead.
Best Value
Validate the network path after reloading
Check each layer separately so a failure is easy to localize.
- Confirm the sockets: run
sudo ss -ltnpand verify that Nginx owns the intended public endpoint and Apache owns the selected backend endpoint. - Test Apache locally: from the server, request the backend address and port directly, for example
curl -I -H 'Host: example.com' http://127.0.0.1:8080/. This tests Apache and its virtual-host selection without involving Nginx. - Test Nginx locally: request the Nginx listener with the expected host header. Include
:8080when that is the configured public port. - Test from a remote client: if the service is meant to be public, use the server’s external hostname or address and check that the path is permitted by host and cloud firewalls.
- Read service logs: inspect the Nginx error log and Apache’s error log at the time of a failed request. A listener error points to binding; a proxy error points to backend reachability or response handling.
Do not treat a successful local test as proof of remote access. A service bound to 127.0.0.1 is intentionally unreachable from another machine, and a public listener can still be blocked by a host firewall or a cloud firewall rule.
Troubleshoot the common failures
“Address already in use” during startup
Another process already owns the exact address-and-port pair, or a wildcard listener covers the address you selected. Use ss -ltnp to identify the owner. Change one service’s endpoint or stop the conflicting service, then retest the configuration. Adding another listen or Listen line with the same binding does not resolve the collision.
The site works on localhost but not remotely
First check the Nginx binding. If it is 127.0.0.1:8080, remote clients are excluded by design; use a public binding only when that exposure is intended. If Nginx is listening on a non-loopback address, inspect the server firewall and any cloud or upstream firewall for an allowed TCP rule on 8080. Also verify that the client is using the configured port in the URL.
Nginx returns 502 Bad Gateway
A 502 means Nginx could not obtain a usable response from the configured upstream. Confirm that Apache is running, listening on the same address and port written in proxy_pass, and reachable from the Nginx process:
sudo ss -ltnp
curl -I http://127.0.0.1:8080/
Use the actual backend port in the test. If the local request fails, fix Apache’s listener, virtual host, permissions, or application first. If it succeeds but Nginx still returns 502, check the Nginx error log for an address mismatch, connection refusal, or timeout.
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 →Apache redirects to 8080, 8081, or another internal port
The application may be constructing absolute URLs from its backend address, or Apache may be returning a redirect that exposes the private port. Ensure the application’s base URL represents the public scheme and host, and that Nginx forwards Host and X-Forwarded-Proto. When Apache itself performs reverse-proxy work, redirect rewriting commonly requires ProxyPassReverse; review redirect headers in either direction rather than assuming the backend port should be visible to users.
The wrong virtual host responds
Check that the request’s Host header matches the intended Nginx server_name, that both blocks use the same listening port you are testing, and that only the intended block is marked default_server for that address-and-port pair. An IP-based request or an unknown hostname will follow default-server rules rather than the named site.
Apache starts but serves the wrong site
Inspect every enabled Apache virtual host and make sure its address-and-port declaration matches the new Listen setting. A site left on an old endpoint may be ignored, while multiple names on the new endpoint can make the first or default virtual host answer unexpected requests. Test with an explicit Host header to distinguish listener problems from name matching.
Quick Recap
Operational and security considerations
- Expose only the intended daemon: bind Apache to loopback when Nginx is the public gateway. This removes a direct path around Nginx controls.
- Open only required firewall ports: allow TCP 8080 externally only when clients genuinely need that public port. A private backend port should not be opened in host or cloud firewall rules.
- Preserve client identity deliberately: pass
X-Real-IPandX-Forwarded-Forto applications that need the original address, and configure the application to trust those headers only from your proxy. - Keep names consistent: use the public hostname in Nginx, Apache, and the application’s base-URL settings. Inconsistent names are a frequent cause of redirect loops and wrong absolute links.
- Reload safely: run
nginx -tandapachectl configtestbefore every reload. A syntax error should be corrected before replacing the running configuration.
Quick decision checklist
- Need Nginx itself on public port 8080? Set Nginx to
listen 8080;and move Apache to an unused endpoint such as127.0.0.1:8081. - Need Nginx as the normal public gateway? Keep Nginx on 80/443, put Apache on a private loopback port such as 8080, and use
proxy_pass. - Need two independent sites? Give each daemon a distinct endpoint and configure separate names and document roots.
- Seeing a bind error? Find the process that owns the exact address-and-port pair before changing anything else.
- Seeing a 502? Test the Apache backend directly from the server, then compare that endpoint with the Nginx
proxy_passvalue.
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.




