Hallo karpfensami,
aus deinem vHost wird nicht klar unter welcher domain deine Nextcloud eigentlich laufen soll.
Hier habe ich mal einige Schritte für dich die als Anleitung bzw. Leitfaden dient. Bitte ersetze example.local durch deine domain oder deine DynDNS Adresse. Die Befehle wurden alle als root ausgeführt. Anmelden als root kannst du dich mit
sudo -i
Zertifikate erstellen mit Let's Encrypt und getssl
Herunterladen von getssl
cd ~
git clone https://github.com/srvrco/getssl.git
Verschieben unter /etc
mv ~/getssl /etc
Domain anlegen für getssl
/etc/getssl/getssl -c example.local
getssl config deiner Domain anpassen unter
nano ~/.getssl/example.local/getssl.cfg
Hier mal ein Ausschnitt aus meiner Konfiguration
# Uncomment and modify any variables you need
# see https://github.com/srvrco/getssl/wiki/Config-variables for details
#
# The staging server is best for testing
#CA="https://acme-staging.api.letsencrypt.org"
# This server issues full certificates, however has rate limits
CA="https://acme-v01.api.letsencrypt.org"
#AGREEMENT="https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf"
# Set an email address associated with your account - generally set at account level rather than domain.
ACCOUNT_EMAIL="webmaster@example.local"
ACCOUNT_KEY_LENGTH=4096
ACCOUNT_KEY="/etc/ssl/private/ca/ca.key"
PRIVATE_KEY_ALG="rsa"
# Additional domains - this could be multiple domains / subdomains in a comma separated list
# Note: this is Additional domains - so should not include the primary domain.
# SANS=www.example.local
# Acme Challenge Location. The first line for the domain, the following ones for each additional domain.
# If these start with ssh: then the next variable is assumed to be the hostname and the rest the location.
# An ssh key will be needed to provide you with access to the remote server.
# If these start with ftp: then the next variables are ftpuserid:ftppassword:servername:ACL_location
# These should be of the form "/path/to/your/website/folder/.well-known/acme-challenge"
# where "/path/to/your/website/folder/" is the path, on your web server, to the web root for your domain.
#ACL=('/var/www/cryptic.systems/web/.well-known/acme-challenge'
# 'ssh:server5:/var/www/cryptic.systems/web/.well-known/acme-challenge'
# 'ftp:ftpuserid:ftppassword:cryptic.systems:/web/.well-known/acme-challenge')
ACL=('/var/www/letsencrypt/.well-known/acme-challenge')
#Enable use of a single ACL for all checks
USE_SINGLE_ACL="true"
# Location for all your certs, these can either be on the server (so full path name) or using ssh as for the ACL
DOMAIN_CERT_LOCATION="/etc/ssl/public/example.local/domain.crt"
DOMAIN_KEY_LOCATION="/etc/ssl/private/example.local/domain.key"
CA_CERT_LOCATION="/etc/ssl/public/example.local/chain.crt"
#DOMAIN_CHAIN_LOCATION="" # this is the domain cert and CA cert
#DOMAIN_KEY_CERT_LOCATION="" # this is the domain_key and domain cert
#DOMAIN_PEM_LOCATION="" # this is the domain_key. domain cert and CA cert
# The command needed to reload apache / nginx or whatever you use
RELOAD_CMD="service apache2 reload"
# The time period within which you want to allow renewal of a certificate
# this prevents hitting some of the rate limits.
RENEW_ALLOW="30"
# Define the server type. This can be https, ftp, ftpi, imap, imaps, pop3, pop3s, smtp,
# smtps_deprecated, smtps, smtp_submission, xmpp, xmpps, ldaps or a port number which
# will be checked for certificate expiry and also will be checked after
# an update to confirm correct certificate is running (if CHECK_REMOTE) is set to true
#SERVER_TYPE="https"
#CHECK_REMOTE="true"
# Use the following 3 variables if you want to validate via DNS
#VALIDATE_VIA_DNS="true"
#DNS_ADD_COMMAND=
#DNS_DEL_COMMAND=
#AUTH_DNS_SERVER=""
#DNS_WAIT=10
#DNS_EXTRA_WAIT=60
Anlegen der SSL-Verzeichnisstruktur
mkdir /etc/ssl/private/example.local -p
mkdir /etc/ssl/private/ca -p
mkdir /etc/ssl/public/example.local -p
.well-known Verzeichnisstruktur anlegen
/var/www/letsencrypt/.well-known/acme-challenge -p
.well-known als Alias in Apache config setzen
mkdir /etc/apache2/conf-available/ -p
touch /etc/apache2/conf-available/letsencrypt.conf
echo "Alias /.well-known /var/www/letsencrypt/.well-known" > /etc/apache2/conf-available/letsencrypt.conf
Alias config aktivieren unter apache2
a2enconf letsencrypt
SSL und Rewrite Modul von Apache aktivieren
a2enmod ssl
a2enmod rewrite
Apache Neustarten
service apache2 restart
Zertifikate erstellen mit getssl, die Zertifikate sollten nun in der SSL-Verzeichnisstruktur erstellt worden sein
/etc/getssl/getssl -f example.local
Zertifikate regelmäßig automatisch updaten durch cronjob
crontab -e -u root
Folgende Zeile am ende einfügen
# Zertifikate updaten
0 0 * * * /etc/getssl/getssl -a -q
Nextcloud einrichten unter Apache2
OPTIONAL: Falls nextcloud nicht unter /var/www/example.local/nextcloud installiert sein sollte
| mkdir /var/www/example.local
mv /<pfad>/<von>/<nextcloud>/<Verzeichnis> /var/www/example.local
|
Am ende muss es das Verzeichnis /var/www/example.local/nextcloud geben, in diesem Verzeichnis befindet sich beispielsweise das Unterverzeichnis config.
vHost-Datei unter /etc/apache2/sites-availible/nextcloud.conf
<VirtualHost *:80>
# Server Details
ServerName example.local
ServerAlias example.local
ServerAdmin webmaster@example.local
# Wurzelverzeichnis und deren Einstellungen
DocumentRoot /var/www/example.local/nextcloud
<Directory /var/www/example.local/nextcloud>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
#Deny from all
Allow from all
</Directory>
# Logs
ErrorLog ${APACHE_LOG_DIR}/example.local/nextcloud/error.log
CustomLog ${APACHE_LOG_DIR}/example.local/nextcloud/access.log combined
# Umleiten auf HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
<VirtualHost *:443>
# Server Details
ServerName example.local
ServerAlias example.local
ServerAdmin webmaster@example.local
# SSLEngine aktivieren (Dafür muss das Modul ssl aktiviert sein, a2enmod ssl)
# Um Generelle SSL Optionen einstellen zu können. Diese SSL Optionen sind gültig für die Verbindung zwischen Client und Server.
SSLEngine on
# SSLCertificateFile
# Pfadangabe der Zertifikatsdatei. Das Zertifikat beinhaltet die Signatur der Certificate Authority (CA) als Gültigkeitsnachweis.
SSLCertificateFile /etc/ssl/public/example.local/domain.crt
# SSLCertificateKeyFile
# Pfadangabe des Privatekeys.
SSLCertificateKeyFile /etc/ssl/private/example.local/domain.key
# SSLCertificateKeyFile
# Pfadangabe des Root-Bundles. Das Root-Bundle ist das Zertifikat der (CA). Es muss angegeben werden, damit der Client unter Angabe
# des Signierten Zertifkates seine eigene Prüfsumme bilden kann um der Seite das vertrauen aus zu sprechen.
SSLCertificateChainFile /etc/ssl/public/example.local/chain.crt
# SSLProtocol
# Legt fest, welcher SSL-Version genutzt werden soll zwischen Client und Server.
SSLProtocol all -SSLv2 -SSLv3
# SSLCipherSuite
# Gibt die CiperSuite an, den Algorythmus, mit dem eine SSL-Verbindung zwischen Client und Server aufgebaut werden soll.
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
# SSLHonorCipherOrder
# Wenn SSLHonorCipherOrder aktiviert ist (on), kann der Client keine CiperSuite vorgeben, die beim Aufbau der SSL Verbindung genutzt werden soll.
# Der Server gibt indemfall die CiperSuite vor.
SSLHonorCipherOrder on
# HTTP Strict-Transport-Security
# Den Client anweisen, in Zukunft direkt per SSL eine Verbindung auf zu bauen, sodass die RewriteRule nicht gebraucht wird.
Header always set Strict-Transport-Security "max-age=31536000;"
# Wurzelverzeichnis und deren Einstellungen
DocumentRoot /var/www/example.local/nextcloud
<Directory /var/www/example.local/nextcloud>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
#Deny from all
Allow from all
</Directory>
# Logs
ErrorLog ${APACHE_LOG_DIR}/example.local/nextcloud/ssl_error.log
CustomLog ${APACHE_LOG_DIR}/example.local/nextcloud/ssl_access.log combined
</VirtualHost>
Erstellen des Logverzeichnisses
mkdir /var/log/apache2/example.local/nextcloud -p
Optional: Alle anderen config's unter site-availible unter Apache deaktivieren
a2dissite *
Nextcloud unter Apache2 aktivieren
a2ensite nextcloud
Änderungen von Apache neu einlesen lassen
service apache2 reload
Das sollte soweit alles sein.
Ich hoffe du hast keine Probleme, wenn du alles in der Reihenfolge machst.
Falls du wo stecken bleibst ruhig melden
Volker