wiki:ApacheNeuerVhost

neuen V-Host erstellen

  1. DNS einrichten: den DNS-Namen für den neuen Host auf die IP-Adresse (oder als CNAME auf den Hostnamen) des Apache-Servers (laubfrosch.p21.net, 172.16.0.2) zeigen lassen
  2. auf Laubfrosch anmelden, root werden
  3. im Verzeichnis /var/www
    1. für eine Web-Service:
      ein neues Verzeichnis mit dem Hostnamen anlegen: mkdir twiki.mtronig.de
    2. für einen Nicht-Web-Server (z.B. IMAP, murmur, ...):
      einen Sym-Link auf localhost anlegen: mkdir ln -s localhost murmur.vpn21.net
  4. SSL Verzeichnis erstellen
    1. mit eigenem SSL-Cert oder als zentrale Stelle für ein Sammel-Cert:
      ein Unterverzeichnis ssl anlegen: mkdir -p twiki.mtronig.de/ssl
    2. zu einem Sammel-Cert hinzufügen:
      einen Symlink auf das ssl Verzeichnis des Sammel-Cert-Halters legen: ln -s ../usvn/ssl twiki.mtronig.de/ssl
    3. für einen Nicht-Web-Server (z.B. IMAP, murmur, ...) ist das im localhost geregelt.
    Im ssl Verzeichnis (Link oder physisch) werden folgende Dateien für die nachfolgende Konfigruation benötigt und müssen durch getssl.sh erstellt werden:
    • ca-bundle.pem
    • server.crt
    • server.key_decrypted
  5. im Host-Verzeichnis die Web-Daten unterbringen, für einen Forwarder auf einen anderen Web-Service via http oder https kommen keine Daten hier hinein.
    Die Web-Daten hier sollten dem apache User gehören: chown -R apache:apache twiki.mtronig.de.
    Eine einfache Datei für den Start oder für Wartungsarbeiten liegt als Anhang dieser Wiki-Seite bei.
  6. im Konfigurations-Verzeichnis /etc/apache2/vhosts.d eine neue Host-Konfiguration erstellen nach dem Namensmuster nn-hostname.mit.domaine.tld.conf. Jeder V-Host bekommt eine eigene Nummer, die vor 99 und auch vor 78 einsortiert wird, normalerweise aufsteigend ab 21 die nächste freie Nummer. Die Konfigurationsdatei richtet sich nach den Eigenschaften des Web-Service, soll aber auf jeden Fall die Teile der SSL-Konfiguration enthalten:
    ### Section 3: Virtual Hosts
    #
    # VirtualHost: If you want to maintain multiple domains/hostnames on your
    # machine you can setup VirtualHost containers for them. Most configurations
    # use only name-based virtual hosts so the server doesn't need to worry about
    # IP addresses. This is indicated by the asterisks in the directives below.
    #
    # Please see the documentation at 
    # <URL:http://httpd.apache.org/docs-2.0/vhosts/>
    # for further details before you try to setup virtual hosts.
    #
    # You may use the command line option '-S' to verify your virtual host
    # configuration.
    
    #
    # Use name-based virtual hosting.
    #
    #NameVirtualHost *:80
    
    #
    # Almost any Apache directive may go into a VirtualHost container.
    # The first VirtualHost section is used for requests without a known
    # server name.
    #
    <VirtualHost *:80>
        ServerName wrp.vpn21.net
        RedirectMatch permanent "^(/(?!.well-known/acme-challenge?).*)" https://wrp.vpn21.net$1
    </VirtualHost>
    
    <VirtualHost *:443>
            ServerName wrp.vpn21.net
    #        SSLProxyEngine On
    #        RequestHeader set Front-End-Https "On"
    
            RequestHeader edit Destination https://wrp.vpn21.net/ http://172.18.2.3:8080/
            ProxyRequests Off
            ProxyPass /.well-known !
            ProxyPass / http://172.18.2.3:8080/
            ProxyPassReverse / http://172.18.2.3:8080/
    
        SSLEngine on
        
        ## Server Certificate:
        # Point SSLCertificateFile at a PEM encoded certificate. If the certificate
        # is encrypted, then you will be prompted for a pass phrase. Note that a 
        # kill -HUP will prompt again. Keep in mind that if you have both an RSA
        # and a DSA certificate you can configure both in parallel (to also allow
        # the use of DSA ciphers, etc.)
        SSLCertificateFile /var/www/wrp.vpn21.net/ssl/server.crt
    
        ## Server Private Key:
        # If the key is not combined with the certificate, use this directive to
        # point at the key file. Keep in mind that if you've both a RSA and a DSA
        # private key you can configure both in parallel (to also allow the use of
        # DSA ciphers, etc.)
        SSLCertificateKeyFile /var/www/wrp.vpn21.net/ssl/server.key_decrypted
    
        ## Server Certificate Chain:
        # Point SSLCertificateChainFile at a file containing the concatenation of 
        # PEM encoded CA certificates which form the certificate chain for the
        # server certificate. Alternatively the referenced file can be the same as
        # SSLCertificateFile when the CA certificates are directly appended to the
        # server certificate for convinience.
        SSLCertificateChainFile /var/www/wrp.vpn21.net/ssl/ca-bundle.pem
    
        Header always add Strict-Transport-Security "max-age=15768000"
    </VirtualHost>
    
  7. weiter mit der Einrichtung von getssl
Last modified 5 years ago Last modified on Aug 1, 2020, 5:10:52 PM

Attachments (1)

  • maintenance.html (877 bytes) - added by Johannes Lode 5 years ago. eine einfache "Sorry"-Seite für den Webseiten-Start und für Wartungssarbeiten

Download all attachments as: .zip