Changes between Initial Version and Version 1 of ApacheNeuerVhost


Ignore:
Timestamp:
Aug 1, 2020, 4:55:46 PM (6 years ago)
Author:
Johannes Lode
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ApacheNeuerVhost

    v1 v1  
     1= neuen V-Host erstellen
     2
     3 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
     4 1. auf Laubfrosch anmelden, `root` werden
     5 1. im Verzeichnis `/var/www`
     6   a. für eine Web-Service: \\ ein neues Verzeichnis mit dem Hostnamen anlegen: `mkdir twiki.mtronig.de`
     7   a. für einen Nicht-Web-Server (z.B. IMAP, murmur, ...): \\ einen Sym-Link auf `localhost` anlegen: `mkdir ln -s localhost murmur.vpn21.net`
     8 1. SSL Verzeichnis erstellen
     9    a. mit eigenem SSL-Cert oder als zentrale Stelle für ein Sammel-Cert: \\ ein Unterverzeichnis `ssl` anlegen: `mkdir -p twiki.mtronig.de/ssl`
     10    a. 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`
     11    a. für einen Nicht-Web-Server (z.B. IMAP, murmur, ...) ist das im `localhost` geregelt.
     12  Im `ssl` Verzeichnis (Link oder physisch) werden folgende Dateien für die nachfolgende Konfigruation benötigt und müssen durch getssl.sh erstellt werden:
     13    * `ca-bundle.pem`
     14    * `server.crt`
     15    * `server.key_decrypted`
     16 1. 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`.
     17 1. 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:
     18{{{
     19### Section 3: Virtual Hosts
     20#
     21# VirtualHost: If you want to maintain multiple domains/hostnames on your
     22# machine you can setup VirtualHost containers for them. Most configurations
     23# use only name-based virtual hosts so the server doesn't need to worry about
     24# IP addresses. This is indicated by the asterisks in the directives below.
     25#
     26# Please see the documentation at
     27# <URL:http://httpd.apache.org/docs-2.0/vhosts/>
     28# for further details before you try to setup virtual hosts.
     29#
     30# You may use the command line option '-S' to verify your virtual host
     31# configuration.
     32
     33#
     34# Use name-based virtual hosting.
     35#
     36#NameVirtualHost *:80
     37
     38#
     39# Almost any Apache directive may go into a VirtualHost container.
     40# The first VirtualHost section is used for requests without a known
     41# server name.
     42#
     43<VirtualHost *:80>
     44    ServerName wrp.vpn21.net
     45    RedirectMatch permanent "^(/(?!.well-known/acme-challenge?).*)" https://wrp.vpn21.net$1
     46</VirtualHost>
     47
     48<VirtualHost *:443>
     49        ServerName wrp.vpn21.net
     50#        SSLProxyEngine On
     51#        RequestHeader set Front-End-Https "On"
     52
     53        RequestHeader edit Destination https://wrp.vpn21.net/ http://172.18.2.3:8080/
     54        ProxyRequests Off
     55        ProxyPass /.well-known !
     56        ProxyPass / http://172.18.2.3:8080/
     57        ProxyPassReverse / http://172.18.2.3:8080/
     58
     59    SSLEngine on
     60   
     61    ## Server Certificate:
     62    # Point SSLCertificateFile at a PEM encoded certificate. If the certificate
     63    # is encrypted, then you will be prompted for a pass phrase. Note that a
     64    # kill -HUP will prompt again. Keep in mind that if you have both an RSA
     65    # and a DSA certificate you can configure both in parallel (to also allow
     66    # the use of DSA ciphers, etc.)
     67    SSLCertificateFile /var/www/wrp.vpn21.net/ssl/server.crt
     68
     69    ## Server Private Key:
     70    # If the key is not combined with the certificate, use this directive to
     71    # point at the key file. Keep in mind that if you've both a RSA and a DSA
     72    # private key you can configure both in parallel (to also allow the use of
     73    # DSA ciphers, etc.)
     74    SSLCertificateKeyFile /var/www/wrp.vpn21.net/ssl/server.key_decrypted
     75
     76    ## Server Certificate Chain:
     77    # Point SSLCertificateChainFile at a file containing the concatenation of
     78    # PEM encoded CA certificates which form the certificate chain for the
     79    # server certificate. Alternatively the referenced file can be the same as
     80    # SSLCertificateFile when the CA certificates are directly appended to the
     81    # server certificate for convinience.
     82    SSLCertificateChainFile /var/www/wrp.vpn21.net/ssl/ca-bundle.pem
     83
     84    Header always add Strict-Transport-Security "max-age=15768000"
     85</VirtualHost>
     86}}}
     87 1. weiter mit der [[ApacheGetsslNeuesCert|Einrichtung]] von `getssl`