Warum läuft Apache auf Port 8080 statt auf Port 80?

Warum läuft Apache auf Port 8080 statt auf Port 80?

Ich bin verwirrt, warum Apache auf Port 80 nicht antwortet ...

$ wget http://localhost:80  
--2014-05-06 15:32:44--  http://localhost/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... failed: Connection refused.

... sondern stattdessen auf Post 8080 ...

$ wget http://localhost:8080
--2014-05-06 15:32:38--  http://localhost:8080/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 177 [text/html]
Saving to: ‘index.html’

100%[=================================================>] 177 --.-K/s   in 0s

2014-05-06 15:32:38 (16,4 MB/s) - ‘index.html’ saved [177/177]

Nicht zu viel zu sehen in der Ausgabe vonapache2ctl:

$ apache2ctl -t -D DUMP_VHOSTS
VirtualHost configuration:
*:80 is a NameVirtualHost
   default server localhost (/etc/apache2/sites-enabled/000-default.conf:1)
   port 80 namevhost localhost (/etc/apache2/sites-enabled/000-default.conf:1)
   port 80 namevhost localhost (/etc/apache2/sites-enabled/000-default.conf:1)

Jedoch,netstatbestätigt den Port:

$ sudo netstat -anp | grep :8080
tcp6       0      0 :::8080        :::*       LISTEN      5353/apache2

Alsgefragt von JoelHier ist das ports.conf:

$ sudo cat /etc/apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default

Listen 8080

<IfModule ssl_module>
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
# NameVirtualHost *:8800
Listen 8800

Antwort1

Warum läuft Apache auf Port 8080 statt auf Port 80?

Der übliche Grund, warum Apache oft so konfiguriert wird, dass es auf diesem Port lauscht, besteht darin, dass ein Prozess unter dem Root-Konto ausgeführt werden muss oder bestimmte Berechtigungen erteilt werden müssen, um auf niedrigeren TCP-Ports als lauschen zu können, 1024und dazu gehört natürlich auch Port 80.

Die Verwendung einer höheren, nicht privilegierten Portnummer ermöglicht die Ausführung von Apache unter einem regulären Konto ohne besondere Konfiguration.

8080ist ein leicht zu merkender Ersatz für 80.

Antwort2

Was ist der Wert der ListenDirektive in der Konfigurationsdatei in /etc/apache2/ports.conf?

Bei Ihnen steht 8080 und 8800, nicht 80, weshalb Sie diese Ergebnisse erhalten haben.

verwandte Informationen