Get the App
SLTechnology News&Howtos  ›  Servers  › 

Nginx switch https certificate online

Shulou Source: shulou.com Published: 2022-06-03 04:24:06 09月22日 Update

Server {listen 80; rewrite ^ (. *) $https://$server_name$1 permanent; server_name example.com; if ("$host"! = 'example.com') {rewrite ^ / (. *) $http://example.com/$1 permanent } access_log logs/web.log main; location / {root web directory; index index.php index.html;} location ~\ .php$ {root web directory; fastcgi_pass unix:/dev/shm/php-fpm.socket Fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME web directory $fastcgi_script_name; include fastcgi_params;}} server {listen 443; ssl on; ssl_certificate / usr/local/data/nginx/conf/https.pem Ssl_certificate_key / usr/local/data/nginx/conf/https.key; ssl_session_timeout 5m; ssl_ciphers ECDHEMurRSA, AES128Muir, GCM SHA256, ECDHEV, ECDH, aCDH, HIGH, null, aNULL, MD5, ADH, RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on. Access_log logs/access_web.log; location / {root web directory; index index.php index.html;} location ~\ .php$ {root web directory Fastcgi_pass unix:/dev/shm/php-fpm.socket; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME web directory $fastcgi_script_name; include fastcgi_params;}} Note rewrite ^ (. *) $https://$server_name$1 permanent

This is a forced redirect. After removing it, both http and https can access it at the same time.

Tags: Directory meanwhile force certificate switch Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS vpn Apple NVidia Shulou Technology