Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nginx switch https certificate online

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report