What Port Does Apache Use for HTTP Traffic?
The Apache HTTP Server defaults to network port 80 for handling unencrypted web traffic. This article provides a quick overview of why port 80 is the standard, how Apache utilizes it to serve website data to browsers, and how system administrators can modify this setting or configure port 443 for secure HTTPS communication.
The Standard for Unencrypted Web Traffic
When a user types a standard URL into a web browser using the
http:// prefix, the browser automatically attempts to
establish a connection over port 80. Because this
assignment is an industry standard managed by the Internet Assigned
Numbers Authority (IANA), users do not need to explicitly type the port
number into their address bar. Apache listens on this port by default to
ensure seamless compatibility with web browsers worldwide.
How Apache Listens on Port 80
Apache manages its port assignments through its primary configuration
file (typically named httpd.conf on Red Hat/CentOS systems
or apache2.conf on Debian/Ubuntu systems). Inside this
file, the Listen directive tells the server which port to
monitor for incoming requests.
The default configuration includes the following line:
Listen 80
When the Apache service starts, it binds to the server’s network interface on port 80, allowing it to intercept HTTP requests, process them, and return the appropriate web pages to the client.
Port 80 vs. Port 443
While port 80 handles standard, unencrypted text traffic, modern web standards heavily prioritize security. It is important to distinguish between the two primary ports Apache uses:
- Port 80 (HTTP): Used for standard, unencrypted web traffic. Data sent over this port is vulnerable to interception.
- Port 443 (HTTPS): Used for secure, encrypted web traffic via SSL/TLS.
Most modern Apache setups use port 80 primarily to capture initial user requests and immediately redirect them to port 443 for a secure connection.
How to Change the Default Port
If port 80 is already in use by another application (such as Nginx or a development server), or if an administrator wants to run Apache on a non-standard port for testing, the port can be easily changed.
- Open the Apache configuration file.
- Locate the
Listen 80directive. - Change
80to the desired alternative port (for example,Listen 8080). - Save the file and restart the Apache service to apply the changes.
When using a non-standard port like 8080, users must explicitly
append the port number to the URL in their browser (e.g.,
http://example.com:8080).