Apache-Konfiguration - So aktivieren Sie zusätzliche Ports

Apache-Konfiguration - So aktivieren Sie zusätzliche Ports

Nach der Installation meines LAMP-Stacks läuft bei mir standardmäßig Port 80 unter http://127.0.1.1/

Jetzt möchte ich neue Ports hinzufügen, zB 8000, 8888.

Wie kann ich sie in meinem Ubuntu 17.04 zu /etc/apache2/apache2.conf hinzufügen?

So mache ich es inArch Linux:

2.2 Entfernen Sie in /etc/httpd/conf/httpd.conf die Kommentarzeichen aus den folgenden beiden Zeilen für Proxy:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

2.3 Vergessen Sie nicht, Port 443 zu Ihren Abhörports in /etc/httpd/conf/httpd.conf hinzuzufügen:

Listen 443
Listen 8888

2.3 Fügen Sie diese Blöcke hinzu:

<VirtualHost *:8888>
    ProxyPreserveHost On
    ProxyRequests Off
    ServerName www.xxxx.co.uk
    ServerAlias xxxx.co.uk
    ProxyPass / http://127.0.0.1:3838/
    ProxyPassReverse / http://127.0.0.1:3838/

    SSLEngine on
    SSLCertificateFile "/etc/letsencrypt/live/xxxx.co.uk/fullchain.pem"
    SSLCertificateKeyFile "/etc/letsencrypt/live/xxxx.co.uk/privkey.pem"
</VirtualHost>

Was ist mit dem Apache in Ubuntu?

Ich sehe nicht einmal:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

in apache2.conf in meinem Ubuntu 17.04.

Antwort1

In Ubuntu Xenial:

  1. Fügen Sie zusätzliche Ports etwa /etc/apache2/ports.confso hinzu:

    Listen 80
    Listen 8888
    
  2. Fügen Sie nun in Ihrer VirtualHostDatei diesen Port wie folgt hinzu:

    <VirtualHost *:80 *:8888>
    
       ....
    </VirtualHost>
    
  3. Starten Sie Apache2 neu:

    sudo apache2ctl restart
    

verwandte Informationen