GNU/Linux >> LINUX-Kenntnisse >  >> Cent OS

So installieren Sie ein kostenloses SSL-Zertifikat für Nginx unter CentOS 8

In diesem Tutorial zeigen wir Ihnen, wie Sie ein kostenloses SSL-Zertifikat für Nginx unter CentOS 8 installieren. Für diejenigen unter Ihnen, die es nicht wussten, Let's Encrypt ist eine kostenlose offene Zertifizierungsstelle ( CA), die kostenlose Zertifikate für Websites und andere Dienste bereitstellt. Der Dienst wird von der Electronic Frontier Foundation, Mozilla, Cisco Systems und Akamai unterstützt.

Dieser Artikel geht davon aus, dass Sie zumindest über Grundkenntnisse in Linux verfügen, wissen, wie man die Shell verwendet, und vor allem, dass Sie Ihre Website auf Ihrem eigenen VPS hosten. Die Installation ist recht einfach und setzt Sie voraus im Root-Konto ausgeführt werden, wenn nicht, müssen Sie möglicherweise 'sudo hinzufügen ‘ zu den Befehlen, um Root-Rechte zu erhalten. Ich zeige Ihnen Schritt für Schritt die Installation des kostenlosen SSL-Zertifikats für Nginx auf dem CentOS 8-Server.

Voraussetzungen

  • Ein Server, auf dem eines der folgenden Betriebssysteme ausgeführt wird:CentOS 8.
  • Es wird empfohlen, dass Sie eine neue Betriebssysteminstallation verwenden, um potenziellen Problemen vorzubeugen.
  • Ein non-root sudo user oder Zugriff auf den root user . Wir empfehlen, als non-root sudo user zu agieren , da Sie Ihr System beschädigen können, wenn Sie als Root nicht aufpassen.

Kostenloses SSL-Zertifikat für Nginx auf CentOS 8 installieren

Schritt 1. Beginnen wir zunächst damit, sicherzustellen, dass Ihr System auf dem neuesten Stand ist.

dnf update

Schritt 2. Installieren von Certbot auf CentOS 8.

Führen Sie diese Befehle in der Befehlszeile auf dem Computer aus, um Certbot zu installieren:

wget https://dl.eff.org/certbot-auto
sudo mv certbot-auto /usr/local/bin/certbot-auto
sudo chown root /usr/local/bin/certbot-auto
sudo chmod 0755 /usr/local/bin/certbot-auto

Führen Sie dann diesen Befehl aus, um ein Zertifikat zu erhalten und Certbot Ihre Nginx-Konfiguration automatisch bearbeiten zu lassen:

sudo /usr/local/bin/certbot-auto --nginx

Das Ergebnis sieht wie folgt aus:

Creating virtual environment...
Installing Python packages...
Installation succeeded.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: your-domain-a.com
2: your-domain-b.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for your-domain-a.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/conf.d/your-domain-a.com.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/your-domain-a.com.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://your-domain-a.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=your-domain-a.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/your-domain-a.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/your-domain-a.com/privkey.pem
   Your cert will expire on 2020-01-12. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again with the "certonly" option. To non-interactively renew *all*
   of your certificates, run "certbot-auto renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Schritt 3. Certbot Cron Job automatisch verlängern.

Let's Encrypt SSL-Zertifikate, die nach 90 Tagen nach der Installation ablaufen und Sie müssen sie erneuern, bevor sie ablaufen. Wenn Sie Zertifikate mit Certbot installiert haben, muss dies der Fall sein hat bereits einen Cron-Job erstellt, um Zertifikate automatisch zu erneuern:

echo "0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot-auto renew" | sudo tee -a /etc/crontab > /dev/null

Herzlichen Glückwunsch! Sie haben erfolgreich kostenlose SSL-Zertifikate installiert. Vielen Dank, dass Sie dieses Tutorial verwendet haben, um Let's Encrypt SSL-Zertifikate auf einem CentOS 8-System zu installieren. Für zusätzliche Hilfe oder nützliche Informationen empfehlen wir Ihnen, die offiziellen Let's Website verschlüsseln.


Cent OS
  1. So installieren Sie das SSL-Zertifikat auf NGINX

  2. So installieren Sie das SSL-Zertifikat auf Apache für CentOS 7

  3. So installieren Sie SSL auf RHEL 8 / CentOS 8

  4. So installieren Sie Nginx unter CentOS 7

  5. Kostenloses SSL für Nginx auf Centos von Let’s encrypt

So installieren Sie Wetty unter CentOS 7

So installieren Sie LetsEncrypt SSL mit Nginx unter CentOS 6

So installieren Sie Let’s Encrypt SSL mit Nginx unter CentOS 7

So installieren Sie ein kostenloses SSL-Zertifikat für Apache unter CentOS 8

So installieren Sie Varnish Cache 6 für Nginx unter CentOS/RHEL 8

Wie installiere ich Nginx unter CentOS 7?