zoukankan      html  css  js  c++  java
  • nginx配置https

    配置https  证书推荐使用腾讯云的免费证书,当然也可以使用openssl自己生成不过会有问题
     
    nginx配置https配置
     
    server {
      listen 443;
      server_name www.my.com; # 项目域名
     
      ssl on;
      ssl_certificate /etc/nginx/conf.d/key/1_admin.yi-insurance.com_bundle.crt; #(证书公钥)
      ssl_certificate_key /etc/nginx/conf.d/key/2_admin.yi-insurance.com.key; #(证书私钥)
     
      ssl_session_timeout 5m;
      ssl_protocols SSLv2 SSLv3 TLSv1;
      ssl_ciphers HIGH:!aNULL:!MD5;
      ssl_prefer_server_ciphers on;
     
     
      location / {
      root /home/www/www.my.com/public/;
      index index.htm index.html index.php;
      #访问路径的文件不存在则重写URL转交给ThinkPHP处理
      if (!-e $request_filename) {
      rewrite ^/(.*)$ /index.php/$1 last;
      break;
      }
      }
      location ~ .php/?.*$ {
      root /home/www/www.my.com/public/;
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      #加载Nginx默认"服务器环境变量"配置
      include fastcgi_params;
      #设置PATH_INFO并改写SCRIPT_FILENAME,SCRIPT_NAME服务器环境变量
      set $fastcgi_script_name2 $fastcgi_script_name;
      if ($fastcgi_script_name ~ "^(.+.php)(/.+)$") {
      set $fastcgi_script_name2 $1;
      set $path_info $2;
      }
      fastcgi_param PATH_INFO $path_info;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name2;
      fastcgi_param SCRIPT_NAME $fastcgi_script_name2;
      }
    }
     
    http强制跳转https
     
    server{
      listen 80;
      server_name www.my.com; # 项目域名
      #rewrite ^/(.*) https://www.my.com$1 permanent;
      location /{
             proxy_pass https://www.my.com;#代理
      }
    }
  • 相关阅读:
    晶振及COMS电路
    笔记16 C# typeof() & GetType()
    笔记15 修饰符
    笔记14 数据库编程技术
    C#基础知识
    C#连接数据库
    笔记13 winform
    笔记12 export to excel (NPOI)
    笔记11 export to excel
    笔记10
  • 原文地址:https://www.cnblogs.com/weishanyun/p/8005152.html
Copyright © 2011-2022 走看看