


What does the error 'address already in use' or 'port 80 is already in use' mean?
Jul 07, 2025 am 12:09 AMThe "Address already in use" error means that another program or service in the system has occupied the target port or IP address. Common reasons include: 1. The server is running repeatedly; 2. Other services occupy ports (such as Apache occupying port 80, causing Nginx to fail to start); 3. The port is not released after crash or restart. You can troubleshoot through the command line tool: Linux/macOS use sudo lsof -i :80 or sudo netstat -tulpn | grep :80; Windows uses netstat -ano | findstr :80 and check the PID. Solutions include: 1. Stop the conflicting process (such as sudo systemctl stop apache2); 2. Change the application listening port (such as Nginx configuration listen 8080); 3. Restart the device to release the locked port; 4. Be careful to manually terminate the zombie process (such as sudo kill -9
When you see the error message "address already in use" or "port 80 is already in use," it means that another program or service on your system is already using the network port or IP address that you're trying to assign to your application.
This commonly happens when running web servers like Apache, Nginx, or a custom app that listens on port 80 (HTTP) or 443 (HTTPS), and something else is already bound to that port.
Why This Happens
There are a few typical reasons why this error pops up:
- Another instance of your server is already running. For example, if you started an Nginx process and try to start another one without stopping the first, it will fail to bind to the same port.
- A different service is using the port. For example, maybe Apache is already running and listening on port 80, so Nginx can't start because it also wants that same port.
- The port wasn't released after a crash or restart. Sometimes, especially during development, if a service crashes or isn't shut down properly, the OS might still think the port is in use for a short time.
It's not always obvious what's causing it — sometimes it's not even a web server. It could be a monitoring tool, a reverse proxy, or even a malicious process.
How to Check What's Using the Port
You can quickly find out which process is holding onto the port by using command-line tools. Here's how:
On Linux/macOS:
sudo lsof -i :80
Or:
sudo netstat -tulpn | grep :80
If lsof
isn't installed, you can usually install it via your package manager ( apt install lsof
or brew install lsof
, depending on your system).
On Windows:
Open Command Prompt and run:
netstat -ano | findstr :80
Then take the PID from the output and look it up in Task Manager.
Once you have the process ID (PID), you can decide whether to stop it or change your app's configuration to use a different port.
What You Can Do About It
Here are some common ways to resolve this issue:
? Stop the conflicting process
If it's something like Apache or another instance of your server, just stop it gracefully:
sudo systemctl stop apache2
Or for Nginx:
sudo systemctl stop nginx
? Change your app's listening port
If you don't need to use port 80 specifically (eg, you're developing locally), configure your app to listen on a different port like 8080 or 3000. In Nginx config, you'd edit:
listen 8080;
? Reboot your machine (temporarily fixes lingering issues)
Sometimes, especially after a crash or unclean shutdown, a port might stay locked. Rebooting clears that state.
? Kill the process manually (use with caution)
If it's a stale process, you can kill it:
sudo kill -9 <PID>
But be careful — killing the wrong process can cause instability or data loss.
Prevent It From Happening Again
To avoid this issue in the future:
- Use systemd or other init systems to manage services, so they start and stop cleanly.
- Always check logs before starting a service — many apps will tell you if they failed to bind due to a conflict.
- Use unique ports for different services during development unless you really need standard ports like 80 or 443.
That's basically it. The “address already in use” error is pretty straightforward once you know where to look — it's just your system telling you someone else is already at the door.
The above is the detailed content of What does the error 'address already in use' or 'port 80 is already in use' mean?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

As we all know, when any file is in use, no other process can access/change it. In this case, when a process attempts to open a file, the operating system locks the file to prevent it from being modified by another process. “The process cannot access the file because it is in use by another process” is such an error message observed by many users on their Windows computers. This error is known to occur in different versions of WindowsOS and WindowsServer. Usually, this error message is observed during using Netsh command on the user’s Windows PC. Another situation where this error occurs is when trying to run the Internet Information Services (IIS) M

This article will explain in detail the numerical encoding of the error message returned by PHP in the previous Mysql operation. The editor thinks it is quite practical, so I share it with you as a reference. I hope you can gain something after reading this article. . Using PHP to return MySQL error information Numeric Encoding Introduction When processing mysql queries, you may encounter errors. In order to handle these errors effectively, it is crucial to understand the numerical encoding of error messages. This article will guide you to use php to obtain the numerical encoding of Mysql error messages. Method of obtaining the numerical encoding of error information 1. mysqli_errno() The mysqli_errno() function returns the most recent error number of the current MySQL connection. The syntax is as follows: $erro

StudioDisplay and LG UltraFine5KDisplay occupy similar positions in the market, but Apple's monitor is $300 more expensive. Here's everything you need to know about how these monitors compare. Six years is a long time in the tech world, and it's also the time since Apple has sold a branded monitor that costs less than $5,000. During this time, Apple partnered with LG to sell the LG UltraFine series, which catered specifically to Mac users. In 2019, Apple stopped selling these LG monitors in favor of ProDisplayXDR, an affordable Mac-friendly display

Solve the "error:expecteddeclarationbefore'}'token" problem in C++ code. In the process of writing C++ code, we often encounter various compilation errors. One of the common errors is "error:expecteddeclarationbefore'}'token". This error usually occurs when there is a pair of braces ({}) in our code that are not matched correctly.

Form Factor and Design Design-wise, Mac Studio is the definition of overcorrected. Its sturdy chassis, nearly the size of three Mac minis stacked on top of one another, is neither pretty nor elegant. Contrary to past approaches, Apple designed this computer by first determining what users wanted in terms of performance and functionality, and then sculpting the machine around those parameters. The Mac Studio isn't an ugly machine, but it's a clear departure from Jony Ive's vision of what a desktop computer should be, and frankly, it's a breath of fresh air. That's not to say Mac Studio doesn't have well-designed areas. For example, the unit is short enough to safely mount on an Apple

How to set up a CentOS system to disable unnecessary network ports and services 1. Introduction In a Linux system, network ports and services are key components for the computer to communicate with the outside world. However, not all network ports and services are necessary, and some may even present security risks. Therefore, it is very important for servers running CentOS systems to disable unnecessary network ports and services. This article will explain how to disable unnecessary network ports and services through simple settings. 2. Disable or not

When Apple showed off Mac Studio at its "Peek Performance" special event, it positioned its latest Mac products as the mainstay. Power users who need high performance can look to the significantly enhanced Mac mini instead of the Mac Pro, which delivers all the promise of upper-tier Apple Silicon chips. It results in what looks like an almost three-tiered Mac mini that has more than enough power to keep content creators happily working. There are rumors that the Mac mini will be updated with a better chip, which the M1 Pro and M1 Max borrow from the 16-inch MacBook Pro. Until the Friday before release,

Ports are the communication medium in computer networks. Each port is used for a specific service. Although traffic is received over the same internet connection, it is distributed between different ports for various purposes. The most commonly used ports are TCP and UDP. Each port also has its own port number. There may be situations where two applications use the same port, meaning let's say one application is set up to listen for traffic on the same port and another application is already associated with that port. In this case, errors may occur, so identifying the port in use and taking appropriate action will help achieve the final result. Let’s see how to identify open ports or ports in use on a Windows machine. Method 1: Check the port being used
