Kann über IP auf Apache zugreifen, aber keine Domäne mit SSL

864
Nathan

Ich habe eine OwnCloud-Installation, ich möchte, dass nur https verfügbar ist und nicht http. Also habe ich Lets Encrypt installiert, was gut installiert ist. Ich habe den Apache-Conf bereits in den Anhang unten geändert. Ich habe einen Forward auf unserem Router für Port 443. Wenn ich zu https: // IP navigiere, funktioniert es, aber ich bekomme eine SSL-Warnung, die normal ist, da verschlüsselt die Domäne aus dem serverName config für Apache gezogen werden kann. Wenn ich zu https://files.domain.org.uk gehe, bekomme ich eine 404.

Was könnte ich falsch machen?

<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. ServerName files.domain.org.uk  ServerAdmin webmaster@localhost DocumentRoot /var/www/owncloud  # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn  ErrorLog $/error.log CustomLog $/access.log combined  # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf RewriteEngine on RewriteCond % =files.domain.org.uk RewriteRule ^ https://%% [END,QSA,R=permanent] </VirtualHost> 
0
Was passiert, wenn Sie den VirtualHost-Direktive-Port von 80 auf 443 ändern (oben in der Datei ``zu`") Im Wesentlichen haben Sie einen Standard-HTTP-Vhost deklariert, aber keinen für HTTPS. Daher kann Apache nicht wissen, wo er nach HTTPS-Inhalten suchen soll. Kinnectus vor 6 Jahren 0
Wenn ich aber zu https: // ExternalIP gehe, dient die Seite, selbst wenn sie auf Port 80 eingestellt ist Nathan vor 6 Jahren 0
Wie seltsam scheint es jetzt zu funktionieren. Wenn Sie Ihren Kommentar in eine Antwort schreiben, wird er als korrekt markiert Nathan vor 6 Jahren 0

1 Antwort auf die Frage

0
Kinnectus

Da Ihre VirtualHost-Direktive für Apache nur eine Direktive für HTTP-Anforderungen (Port 80) enthält, wenn Sie eine HTTPS-Ressource (Port 443) anfordern, prüft Apache die Direktiven und kann keine Übereinstimmung finden, da Sie keine für Port 443 deklariert haben .

Ändern <VirtualHost *:80>zu <VirtualHost *:443>werden Apache sagen, dass jeder Antrag auf Port 443, die Servernamen übereinstimmt files.domain.org.uk sollte in Ihrer DocumentRoot sucht die Skripte Ihrer Website anzuzeigen.

Möglicherweise möchten Sie entweder die <VirtualHost *:80>Direktive beibehalten, wenn Sie zu http://files.domain.org.uk wechseln möchten, aber eine Zertifikatswarnung erhalten möchten, oder die Weiterleitung von HTTP zu HTTPS beibehalten.