Heim  >  Artikel  >  Betrieb und Instandhaltung  >  So konfigurieren Sie Nginx für die Implementierung von SSL zur Implementierung von https

So konfigurieren Sie Nginx für die Implementierung von SSL zur Implementierung von https

WBOY
WBOYnach vorne
2023-05-25 08:31:051199Durchsuche

1. Nginx-SSL-Modul installieren

Überprüfen Sie, ob das SSL-Modul installiert ist:

cd /usr/local/nginx/sbin
./nginx -V
[root@server-c00ef8c3-710d-4708-9cde-2c864e7c03e2 sbin]# ./nginx -V
nginx version: nginx/1.21.4
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
configure arguments: --prefix=/usr/local/nginx

Wenn configure arguments: --with-http_ssl_module nicht angezeigt wird, bedeutet dies, dass es nicht installiert ist.

2. Installieren Sie

cd /usr/local/nginx-1.21.4
./configure --prefix=/usr/local/nginx --with-http_ssl_module
make
cp ./objs/nginx /usr/local/nginx/sbin/

3. Überprüfen Sie erneut, ob das SSL-Modul installiert wurde:

cd /usr/local/nginx/sbin
./nginx -V
[root@server-c00ef8c3-710d-4708-9cde-2c864e7c03e2 sbin]# ./nginx -V
nginx version: nginx/1.21.4
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module

2. Stellen Sie das SSL-Zertifikat bereit.

Kopieren Sie das angewendete SSL-Zertifikat in das Zertifikatsverzeichnis:

3. Konfigurieren Sie nginx.conf

Aktive Internetverbindungen (nur Server)So konfigurieren Sie Nginx für die Implementierung von SSL zur Implementierung von https

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Programmname

tcp 0 0 0.0.0.0:80 0.0.0.0: LISTEN 21307/nginx: master

tcp 0 0 0.0.0.0:22 0.0.0.0: LISTEN 3072/sshd

tcp 0 0 0.0.0.0:443 0.0.0.0???? LISTEN 21307/nginx: master

# Port 80-Prozess beenden

$ kill 21307

Starten Sie Nginx erneut:

cd /usr/local/nginx/conf
vi nginx.conf

Das obige ist der detaillierte Inhalt vonSo konfigurieren Sie Nginx für die Implementierung von SSL zur Implementierung von https. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Stellungnahme:
Dieser Artikel ist reproduziert unter:yisu.com. Bei Verstößen wenden Sie sich bitte an admin@php.cn löschen