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 problemsRun the Java application on its private port 8080, then put a reverse proxy such as Nginx on public port 80. The proxy receives browser requests, selects the blog or Java application by hostname or URL path, and forwards Java traffic to 127.0.0.1:8080. In Spring Boot, set server.port=8080 and explicitly enable forwarded-header handling so redirects, secure cookies, client addresses and request schemes remain correct behind the proxy.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
The layout that works
A single server can expose several web services through one public HTTP port. Only the reverse proxy listens on port 80; the Java process listens on 8080 and the blog listens on its own local port. The proxy becomes the traffic director.
As an Amazon Associate I earn from qualifying purchases.
- Public edge: Nginx listens on
:80(and, if you later add HTTPS, usually on:443). - Java service: Spring Boot listens on
127.0.0.1:8080. - Blog service: its engine listens on another local port, such as the port chosen by that engine.
- Routing rule: Nginx chooses a destination from the hostname (
app.example.comversusblog.example.com) or from a path (/app/versus/blog/).
This arrangement avoids asking the JVM to bind a privileged public port and gives one place to manage headers, access logs, TLS termination and request limits. The blog software is not specified by this setup, so its own listening port and base-URL settings must come from that software’s documentation.
Choose hostname or path routing
Hostnames are usually the cleaner split
Use separate DNS names when you control more than one hostname. Requests for app.example.com can go to Java, while blog.example.com goes to the blog. Each application receives the root path it expects, which reduces problems with generated links, static files and cookies.
Paths share one hostname
If both services must appear under one name, route prefixes such as /app/ and /blog/. Confirm that each application supports a non-root base path. Some blog engines generate absolute links beginning at /; they may need a configured URL prefix or careful proxy rewriting. Do not assume a path split works merely because Nginx can match the path.
Prepare the server and check for conflicts
- Reserve DNS names for the services if you are using hostname routing. Both names should resolve to the server’s public address.
- Check whether another process already owns port 80:
sudo ss -tlnp | grep :80If the command shows a listener, stop it or choose a different edge design before starting Nginx.
- Confirm that the Java runtime and your packaged application are installed, and identify the blog’s local listening port.
- Plan firewall rules so public traffic reaches the proxy, while the Java and blog ports remain reachable only from the local machine or the proxy. Exact firewall commands depend on the operating system and firewall manager.
On typical Linux systems, ports below 1024 require root privileges or the CAP_NET_BIND_SERVICE capability. Keeping Java on 8080 means the JVM does not need that privilege; let the proxy, which is designed to start with the required permission and then handle requests, own port 80.
Free tools Windows power users keep installed
One-click scans. No signup required.
Configure Spring Boot to listen on 8080
Set the port in application properties
Spring Boot’s embedded server uses port 8080 as the normal standalone HTTP port. Make the intended value explicit in src/main/resources/application.properties:
server.port=8080
server.forward-headers-strategy=NATIVE
The first property fixes the application port. The second is discussed in detail below; choose FRAMEWORK instead if you need Spring’s forwarded-header filter rather than the servlet container’s native support.
Rank #2
The equivalent YAML is:
server:
port: 8080
forward-headers-strategy: NATIVE
Override the port at launch
A packaged application can receive the same setting from the command line:
java -jar app.jar --server.port=8080
Spring Boot’s relaxed binding also recognizes the environment variable SERVER_PORT. This is useful when the same artifact is deployed in several environments:
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →SERVER_PORT=8080 java -jar app.jar
Do not set conflicting values in a properties file, environment and command line without deciding which one should win. The command-line property is an explicit deployment override, so record it in the service definition or startup documentation.
Bind privately when the proxy is on the same host
If Nginx and Java run on one machine, binding Java to 127.0.0.1:8080 prevents direct external connections to the application port. The exact property is environment-dependent; where supported by your Spring Boot version, use:
server.address=127.0.0.1
Verify the resulting listener with ss. If the application must be reached from a separate proxy host, bind to the server’s private interface instead and restrict that interface with network policy. Do not expose 8080 publicly merely because the application starts successfully there.
Configure Nginx as the port-80 reverse proxy
The following is an illustrative layout. Replace the domain names and blog upstream port with your real values, and validate the configuration against the Nginx version and operating-system packaging you use.
Hostname-based example
upstream java_app {
server 127.0.0.1:8080;
}
upstream blog_app {
server 127.0.0.1:8081;
}
server {
listen 80;
server_name app.example.com;
location / {
proxy_pass http://java_app;
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;
}
}
server {
listen 80;
server_name blog.example.com;
location / {
proxy_pass http://blog_app;
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;
}
}
Both server blocks listen on port 80, but the server_name value determines which block handles a request. The proxy sends the original host and scheme to the application and appends the connecting address to the forwarding chain. The blog’s upstream port in this example is only a placeholder for the port your blog actually uses.
Path-based example
server {
listen 80;
server_name example.com;
location /app/ {
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;
}
location /blog/ {
proxy_pass http://127.0.0.1:8081/;
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;
}
}
The trailing slashes in a path proxy can change how Nginx rewrites the URI before forwarding it. Test the exact result with your application’s routes. If the Java application is not designed to live below /app/, hostname routing is usually less troublesome.
Rank #4
Validate and reload
- Check syntax before changing a running proxy:
sudo nginx -t - Reload only after the test succeeds:
sudo systemctl reload nginx - Confirm that Nginx is listening:
sudo ss -tlnp | grep :80
A reload normally preserves existing connections while applying the new configuration. If the syntax test fails, use the reported file and line number; do not replace a working configuration with an unvalidated copy.
Forwarded headers: choose the Spring Boot strategy
A proxy terminates the browser connection and creates a new connection to Java. Without forwarded-header support, the application may believe the request was HTTP, addressed to 127.0.0.1, and generated by the proxy rather than by the visitor. That can produce incorrect redirects, absolute URLs, secure-cookie decisions and audit data.
| Value | How Spring handles forwarded headers | When it fits |
|---|---|---|
NATIVE |
Uses the servlet container’s own forwarded-header support. | Use when the embedded container’s native support is appropriate for your deployment. |
FRAMEWORK |
Uses Spring’s ForwardedHeaderFilter for servlet applications or ForwardedHeaderTransformer for reactive applications. |
Use when you want Spring Framework to process the headers explicitly. |
NONE |
Ignores X-Forwarded-* headers. |
Use only when no trusted proxy is supplying those headers. |
Spring Boot can default to NATIVE on a supported cloud platform and to NONE elsewhere. A self-managed Nginx host therefore should not rely on an automatic default; set the property deliberately.
Overwrite headers at the edge
Forwarded headers are not inherently trustworthy: a client can send them in its original request. The edge proxy must overwrite or strip incoming values and set its own values. The Nginx directives above set Host, X-Forwarded-For and X-Forwarded-Proto. If another proxy sits in front of Nginx, define the trusted-proxy chain carefully so the application does not accept arbitrary client-supplied address or scheme data.
Best Value
Start-up order and first verification
- Start the blog on its private port and verify it responds locally.
- Start the Java application and verify its health endpoint or home page locally on port 8080.
- Run Nginx’s configuration test, then reload Nginx.
- From the server, request each upstream directly to separate application failures from proxy failures:
curl -I http://127.0.0.1:8080/ - From a client, request the public hostname or path and inspect the status, redirect location and page links:
curl -I http://app.example.com/ - Check the proxy and application logs together while making one request. The request should appear at Nginx, then at Java with the expected host and scheme.
Do not test only the home page. Exercise a redirect, a static asset, a login or session flow if the application has one, and an endpoint that records the client address. These expose incorrect host, scheme, path and forwarded-header settings quickly.
Troubleshoot the common failure branches
Port 80 will not start
Use ss to identify the existing listener. Stop the conflicting service or move it behind Nginx. If Nginx reports a permission error, confirm that it is being started through the operating system’s service manager with the permissions required to bind port 80.
Nginx returns 502 Bad Gateway
A 502 generally means the proxy cannot complete its connection to the configured upstream. Confirm that Java is running, that it is listening on the address and port in proxy_pass, and that local security rules permit Nginx to connect. Test the upstream with curl from the same host.
The application redirects to port 8080
Check that Nginx sends Host and X-Forwarded-Proto, and that Spring Boot uses NATIVE or FRAMEWORK rather than NONE. Also check the application’s own public URL setting; a proxy cannot correct an application that is configured to advertise an internal address.
Client IPs show as 127.0.0.1
Ensure Nginx sets X-Forwarded-For and that Spring’s selected strategy processes it. If there is an additional load balancer, configure the trusted proxy chain instead of accepting arbitrary forwarding headers from the internet.
Only the blog fails under a path prefix
Inspect generated asset and navigation URLs. The blog may require a base URL containing /blog/, or the proxy may be stripping or retaining the prefix differently than the blog expects. Switch to a dedicated hostname when the blog cannot operate below a prefix.
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 reinstallDecide where HTTPS belongs
The same architecture can terminate TLS at Nginx while Java continues to listen on HTTP 8080 locally. In that arrangement, Nginx must forward X-Forwarded-Proto: https for secure requests, and Spring must process it. If TLS is terminated elsewhere, ensure the final trusted proxy supplies an accurate scheme and that each hop is accounted for. Do not expose an unencrypted 8080 listener to the public internet as a substitute for edge TLS.
Quick Recap
Operational checklist
- Java is configured with
server.port=8080and, for a same-host proxy, a private bind address. - Nginx is the only service intended to listen publicly on port 80.
- Each hostname or path maps to the correct upstream.
Host,X-Forwarded-ForandX-Forwarded-Protoare overwritten at the edge.- Spring Boot uses an intentional forwarded-header strategy:
NATIVEorFRAMEWORKbehind Nginx, not an accidentalNONE. nginx -tsucceeds before every reload.- Direct upstream tests and public tests both pass, including redirects and static assets.
- Java and blog ports are restricted so the proxy is the normal entry point.
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.




