lqy_5 发表于 2016-12-26 15:33:03

http 与 https 共存

本帖最后由 lqy 于 2016-12-26 15:52 编辑

请教一下,我修改 nginx.conf,将后半段的 # 取消,做了小微调,注释掉 ssl on;,listen443 改为 listen443 ssl ,其他不懂所以不改,在测试机里测试可以实现http、https共存,但不敢用在工作机中,先征求各位意见,是否稳妥。

    # HTTPS server
   
    server {
      listen       443 ssl;
      server_namelocalhost;
      root   D:/MYOA/webroot/;
      indexindex.php index.html index.htm;
      error_log ../logs/nginx_ssl_error.log;
   
    #    ssl                  on;
      ssl_certificate      1_oa.gdddd.com_bundle.crt;
      ssl_certificate_key2_oa.gdddd.com.key;
   
      ssl_session_timeout5m;
   
      ssl_protocolsTLSv1 TLSv1.1 TLSv1.2;
      ssl_ciphersXXXXX-RSA-XXX128-GGG-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
      ssl_prefer_server_ciphers   on;
   
      if (-d $request_filename){
            rewrite ^/(.*)([^/])$ $scheme://$http_host/$1$2/ permanent;
      }
      
      location ~* ^/(attachment|static|images|theme|templates|wav)/.*\.(php|.php3|.php5|jsp|asp)$ {
            deny all;
      }
   
      location ~ \.php$ {
            fastcgi_pass   OfficeFPM;
            fastcgi_indexindex.php;
            include      fastcgi.conf;
      }
      
      location /general/document/index.php/ {
            fastcgi_passOfficeFPM;
            fastcgi_indexindex.php;
            include      fastcgi.conf;
         
            fastcgi_paramSCRIPT_FILENAME   D:/MYOA/webroot/general/document/index.php;
            fastcgi_paramSCRIPT_NAME       /general/document/index.php;
            fastcgi_split_path_info          ^(.+\.php)/(.*)$;
            fastcgi_paramPATH_INFO         $fastcgi_path_info;
            fastcgi_param PATH_TRANSLATED    $document_root$fastcgi_path_info;
      }
      
      location /general/itask/router.php/ {
            fastcgi_pass   OfficeFPM;
            fastcgi_indexindex.php;
            include      fastcgi.conf;
            
            fastcgi_paramSCRIPT_FILENAME   D:/MYOA/webroot/general/itask/router.php;
            fastcgi_paramSCRIPT_NAME       /general/itask/router.php;
      }
   
      location ~* ^/attachment/(background|im|new_sms|reportshop|cache|data_center) {
            allow all;
      }
   
      location /attachment {
            deny all;
      }
   
      include   common.conf;
    }

通达丁森林 发表于 2016-12-26 17:08:06

您好,关于https协议ssl的设置会涉及到相关ssl厂商提供相应的证书,建议参考文档设置。

lqy_5 发表于 2016-12-27 09:38:34

通达丁森林 发表于 2016-12-26 17:08 static/image/common/back.gif
您好,关于https协议ssl的设置会涉及到相关ssl厂商提供相应的证书,建议参考文档设置。 ...

ssl证书已有,通过上面的修改,能通过苹果ats检测,所以希望普通的http供PC精灵使用,https就提供给微信和ios客户端使用。上面配置文件的 ssl-certificate 和 ssl-ciphers 项做了模糊处理。

lyz7805 发表于 2016-12-27 13:12:05

两种模式完全可以共存的,一个占用80端口,一个占用443端口,不冲突。只是你这样让有的客户用http有的用https就很容易弄混,最好就用一种,当然推荐使用https。

lqy_5 发表于 2016-12-27 13:50:37

回楼上,可以共存就行,80端口不关闭,原有的pc精灵、安卓客户端就不用改任何设置直接用,443端口可以满足苹果、微信的需要。其实,也没有什么混淆的,难道同一个用户会同一时间分别用http和https登录吗?没这么闲着搞事的吧。
页: [1]
查看完整版本: http 与 https 共存