Free tools Windows power users keep installed
One-click scans. No signup required.
To make an Nginx HTTP server accept connections on more than one port, add a listen directive for each address-and-port endpoint inside its server block. Use one block when the ports should share the same configuration; use separate blocks when their behavior needs to differ.
Use one server block when both ports serve the same site
Add each port with its own listen directive. For example, this configuration applies the same virtual-server settings to requests arriving on ports 80 and 8080:
As an Amazon Associate I earn from qualifying purchases.
server {
listen 80;
listen 8080;
server_name example.com;
root /var/www/example;
}
The HTTP listen directive specifies the address and port on which a server accepts requests. A server block can contain multiple such directives, describing the endpoints on which that configuration is available.
Use separate blocks for port-specific behavior
If a port needs different settings, route requests to separate server blocks by giving each block its own listen directive and configuration. Nginx first matches the connection’s destination address and port, then compares the request’s Host header with the server_name values among the matching servers. If no name matches, it uses the default server for that address-and-port pair. See the request processing documentation.
#1 Best Overall
For example, the following assigns different defaults on ports 80 and 8080:
server {
listen 80 default_server;
listen 8080;
server_name example.org;
}
server {
listen 80;
listen 8080 default_server;
server_name example.net;
}
default_server is associated with a specific address-and-port pair, not with a server name. If no server for a pair declares it, the first server configured for that pair is the default. The server names documentation shows how defaults can differ by port.
Rank #2
Choose the address and address family
A port-only directive such as listen 8080; is appropriate when you want to use the applicable wildcard address. To bind to a particular interface, specify its address and port, for example listen 127.0.0.1:8000; or listen 192.0.2.10:8080;. The HTTP directive also accepts an address without a port; in that form, the documented port is 80.
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 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteFor IPv6, enclose the literal address in brackets: listen [::]:8080; or listen [::1]:8080;. The documented ipv6only option defaults to on for an IPv6 wildcard socket, so do not assume that an IPv6 listener also accepts IPv4 connections. Confirm the behavior and reachability on the host and deployment where Nginx runs. The HTTP core documentation describes the supported listener forms and options.
Rank #3
- Upgraded Two Zipper Pockets: Forvencer server books feature two secure zipper pockets for better organization of coins, cash, and receipts, ensuring that everything you collect has a safe and secure place
- Smart Storage & Quick Access: Designed with 8 multi-functional compartments, the right side includes a guest receipt pad, while the left has a money pocket, ticket pocket, and credit card slot. Two small clear pockets store bills, receipts, and other visible items. A stitched pen loop ensures you always have your favorite pen ready
- High-quality & Easy to Clean: Crafted from high-quality PU leather with heavy-duty stitching, this server book is built to last. It resists tears, scratches, and its waterproof surface makes cleaning easy with just a damp cloth or a non-chlorine sanitizer
- Perfect Fit for Your Apron: Measuring 5” x 8”, this compact organizer is slightly smaller than other models, making it ideal for bending or sitting while carrying in your server apron. It holds everything a waitress needs—a place for everything
- What's Included: This server organizer comes with multiple open and zippered pockets to store money, receipts, tips, etc. Clear sleeves are perfect for keeping menus or special lists while serving. Available in a variety of colors, allowing you to express yourself even when in uniform
Nginx can also listen on a UNIX-domain socket, using a path such as listen unix:/var/run/nginx.sock;. This is a socket endpoint, not a TCP port.
Test the configuration before applying it
-
Edit the relevant HTTP configuration and add the required
listendirective or directives to the intended server block. -
Run
nginx -t. Nginx documents this option as checking configuration syntax and attempting to open files referenced by the configuration. See the command-line switches reference.Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
If the test succeeds, reload Nginx using the procedure documented for the service manager and installation on your host. There is no single reload command that applies to every environment.
Keep protocol and version differences in mind
This configuration applies to HTTP server blocks. Nginx’s stream and mail modules have separate listener directives and protocol-specific behavior. In particular, the stream module documents port-range syntax; do not apply stream-specific syntax to an HTTP listen directive. The stream module documentation covers its listener separately.
Optional HTTP listener parameters can vary by Nginx version. The current HTTP core documentation notes that the http2 listen parameter is deprecated in favor of the http2 directive, while QUIC support is configured separately. Check documentation for the version installed on your server before adopting optional parameters. A valid Nginx configuration also does not by itself establish that a port is reachable from outside the host: interface availability, firewall rules, cloud security groups, and network routing depend on the deployment.
Quick Recap
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.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minute




