Werbung / Banner buchen
Neuigkeiten
  • Die modified eCommerce Shopsoftware ist kostenlos, aber nicht umsonst.
    Spenden
  • Damit wir die modified eCommerce Shopsoftware auch zukünftig kostenlos anbieten können:
    Spenden
  • Thema: SSL mit letsencrypt cerbot - nur ohne www in Domain

    mahagma

    • Fördermitglied
    • Beiträge: 211
    Hallo

    Ich nutze ein Ubuntu 14.04 und möchte auf diesem Server SSL aktivieren.

    Dazu habe ich folendes ausgeführt:
    Code: PHP  [Auswählen]
    sudo apt-get install software-properties-common
    sudo add-apt-repository ppa:certbot/certbot
    sudo apt-get update
    sudo apt-get install python-certbot-apache
    sudo certbot --apache
     

    Mit dem letzten Befehl wird der certbot gestartet und ich soll wählen für welche Domain HTTPS aktiviert werden soll. Hier werden mit (glaube ich zumindest) die virtualhosts angezeigt.

    Es wird gelistet:
    meinedomain.de
    WWW.meinedomain.de

    Hier stellt sich nun die erste Frage. Soll ich den zertbot für beide nutzen, oder nur für eine Domain und dann irgend etwas anpassen, dass das Zertifikat für beide Domains genutzt wird, oder soll ich ein Zertifikat erstellen ohne diese Eingabeaufforderung z.b. mit:
    Code: PHP  [Auswählen]
    sudo certbot --apache certonly -d meinedomain.de -d www.meinedomain.de


    Linkback: https://www.modified-shop.org/forum/index.php?topic=38751.0
    Shop Hosting

    mahagma

    • Fördermitglied
    • Beiträge: 211
    Re: SSL mit letsencrypt cerbot - nur ohne www in Domain
    Antwort #1 am: 25. März 2018, 17:09:57
    Auch wenn ich für beide Domains mit dem certbot über das CLI HTTPS aktiviere wird nur eine Datei erstellt namens:
    Code: PHP  [Auswählen]
    ls /etc/apache2/sites-enabled/meinedomain.de-le-ssl.conf

    Ebenso ist hier noch die Datei namens:
    Code: PHP  [Auswählen]
    /etc/apache2/sites-enabled/meinedomain.de.conf
    /etc/apache2/sites-enabled/000-default.conf
     
    Wobei die erste Datei von mir selbst erstellt wurde:
    Code: PHP  [Auswählen]
    SITE="meinedomain.de"
    cp /etc/apache2/sites-available/000-default.conf cp /etc/apache2/sites-available/$SITE
    cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/$SITE
    nano /etc/apache2/sites-available/$SITE #edit
    sudo a2ensite $SITE
    ls /etc/apache2/sites-available

    Apache 2.4.7

    Inhalt /etc/apache2/sites-enabled/meinedomain.de.conf
    Code: PHP  [Auswählen]
    <VirtualHost *:80>
            ServerName meinedomain.de
            ServerAlias www.meinedomain.de
            ServerAdmin webmaster@localhost
            DocumentRoot /home/meinedomain.de/public_html/
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =meinedomain.de [OR]
    RewriteCond %{SERVER_NAME} =www.meinedomain.de
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    </VirtualHost>

    Inhalt /etc/apache2/sites-enabled/meinedomain.de-le-ssl.conf
    Code: PHP  [Auswählen]
    <IfModule mod_ssl.c>
    <VirtualHost *:443>
            ServerName meinedomain.de
            ServerAlias www.meinedomain.de
            ServerAdmin webmaster@localhost
            DocumentRoot /home/meinedomain.de/public_html/
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/meinedomain.de-0001/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/meinedomain.de-0001/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/meinedomain.de-0001/chain.pem
    </VirtualHost>
    </IfModule>
    <IfModule mod_ssl.c>
    <VirtualHost *:80>
            ServerName meinedomain.de
            ServerAlias www.meinedomain.de
            ServerAdmin webmaster@localhost
            DocumentRoot /home/meinedomain.de/public_html/
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
    # Some rewrite rules in this file were disabled on your HTTPS site,
    # because they have the potential to create redirection loops.

    # RewriteCond %{SERVER_NAME} =meinedomain.de [OR]
    # RewriteCond %{SERVER_NAME} =www.meinedomain.de
    # RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    </VirtualHost>
    </IfModule>
    <IfModule mod_ssl.c>
    <VirtualHost *:80>
            ServerName meinedomain.de
            ServerAlias www.meinedomain.de
            ServerAdmin webmaster@localhost
            DocumentRoot /home/meinedomain.de/public_html/
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
    # Some rewrite rules in this file were disabled on your HTTPS site,
    # because they have the potential to create redirection loops.

    # RewriteCond %{SERVER_NAME} =meinedomain.de [OR]
    # RewriteCond %{SERVER_NAME} =www.meinedomain.de
    # RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    </VirtualHost>
    </IfModule>
    <IfModule mod_ssl.c>
    <VirtualHost *:80>
            ServerName meinedomain.de
            ServerAlias www.meinedomain.de
            ServerAdmin webmaster@localhost
            DocumentRoot /home/meinedomain.de/public_html/
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
    # Some rewrite rules in this file were disabled on your HTTPS site,
    # because they have the potential to create redirection loops.

    # RewriteCond %{SERVER_NAME} =meinedomain.de [OR]
    # RewriteCond %{SERVER_NAME} =www.meinedomain.de
    # RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    </VirtualHost>
    </IfModule>
    <IfModule mod_ssl.c>
    <VirtualHost *:80>
            ServerName meinedomain.de
            ServerAlias www.meinedomain.de
            ServerAdmin webmaster@localhost
            DocumentRoot /home/meinedomain.de/public_html/
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
    # Some rewrite rules in this file were disabled on your HTTPS site,
    # because they have the potential to create redirection loops.

    # RewriteCond %{SERVER_NAME} =meinedomain.de [OR]
    # RewriteCond %{SERVER_NAME} =www.meinedomain.de
    # RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    </VirtualHost>
    </IfModule>

    In letzterem Code scheinen bestimmte Stellen mehrmals vorzukommen!?
    Sind beide Dateien überhaupt notwendig?

    mahagma

    • Fördermitglied
    • Beiträge: 211
    Re: SSL mit letsencrypt cerbot - nur ohne www in Domain
    Antwort #2 am: 25. März 2018, 18:48:15
    Hier noch mein Umweg zu Lösung :-)

    Da ja zwei virtualhost für die selbe Domain registriert waren habe ich die von Apache stehen lassen und meine entfernt und auch mit dem certbot mal alles angelegte gelöscht:
    Code: PHP  [Auswählen]
    sudo a2dissite meinedomain.de &&  service apache2 reload
    certbot delete
     

    Dann noch
    Code: PHP  [Auswählen]
    sudo certbot --apache certonly -d meinedomain.de -d www.meinedomain.de
    sudo a2ensite meinedomain.de-le-ssl.conf
     

    Jedenfalls funktioniert es nun mit folgender Konfiguration des virtualhost:
    Code: PHP  [Auswählen]
    <IfModule mod_ssl.c>
    <VirtualHost *:443>
            ServerName meinedomain.de
            ServerAlias www.meinedomain.de
            ServerAdmin webmaster@localhost
            DocumentRoot /home/meinedomain.de/public_html/
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/meinedomain.de/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/meinedomain.de/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/meinedomain.de/chain.pem
    </VirtualHost>
    </IfModule>
    <IfModule mod_ssl.c>
    <VirtualHost *:80>
            ServerName meinedomain.de
            ServerAlias www.meinedomain.de
            ServerAdmin webmaster@localhost
            DocumentRoot /home/meinedomain.de/public_html/
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
    # Some rewrite rules in this file were disabled on your HTTPS site,
    # because they have the potential to create redirection loops.

     RewriteCond %{SERVER_NAME} =meinedomain.de [OR]
     RewriteCond %{SERVER_NAME} =www.meinedomain.de
     RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    </VirtualHost>
    </IfModule>

    tail /var/log/apache2/error.log
    service apache2 start
    service apache2 reload

    Timm

    • Fördermitglied
    • Beiträge: 6.267
    Re: SSL mit letsencrypt cerbot - nur ohne www in Domain
    Antwort #3 am: 25. März 2018, 19:46:31
    Wie gesagt, ich kenn mich nicht damit aus, aber ich weiß noch, als ich bei einem Bekannten auf dem Server mit war, dass der auch ziemliche Probleme mit dem Zertifikat anfangs hatte. Was du rechtzeitig bedenken solltest ist, wie sich das Zertifikat automatisch verlängert, sonst stehst du dann da und hast keine Zeit, wenn es abgelaufen ist. Am Anfang hatte er das immer manuell für mich gemacht. Irgendwann ging das aber automatisch.

    Gruß Timm

    mahagma

    • Fördermitglied
    • Beiträge: 211
    Re: SSL mit letsencrypt cerbot - nur ohne www in Domain
    Antwort #4 am: 25. März 2018, 21:05:23
    Danke für den Hinweis, hätte ich doch glatt vergessen :-)

    crontab -e
    02 08 * * * letsencrypt renew
    8 Antworten
    3103 Aufrufe
    23. Dezember 2016, 19:56:58 von hpzeller
    10 Antworten
    4384 Aufrufe
    10. Juni 2013, 09:33:47 von fishnet
    14 Antworten
    5828 Aufrufe
    17. Mai 2018, 13:03:04 von cplasa
    2 Antworten
    3085 Aufrufe
    20. April 2010, 16:55:52 von os-design.eu
               
    anything