nginx不传递默认页面的SSL参数

时间:2017-05-04 04:53:17

标签: ssl nginx fastcgi

我正面临这个问题 经过长时间的试验和错误,我得出结论。如果用户第一次访问主页,我的nginx服务器不会将SSL参数传递给PHP。

it works well if the user clicks some other links.
it works well when user first time visit other links.
it works well even for Home page second time.

要查看,请访问我的网站test.jawabee.in,在这里您可以搜索[SSL_PROTOCOL] =>如果您第一次访问主页,则缺少TLSv1.2。

要再次测试,请强行终止浏览器(从任务管理器)

这是我的nginx.comf。

 server {
    listen       443 ssl ;
    server_name  test.jawabee.in;
    root         /usr/share/nginx/jawabee;
    ssl_certificate /etc/letsencrypt/live/test.jawabee.in/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/test.jawabee.in/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/test.jawabee.in/chain.pem;
    ssl_session_cache off;
    include /etc/nginx/conf.d/testjawabee.template;
}

这是我的testjawabee.template

    index index.php index.html index.htm;
    location ~ (^\.|/\.) {
        return 403;
    }
    location / {
        try_files $uri $uri/ @elgg;
    }
    location ~ \.php$ {
        try_files $uri @elgg;
        fastcgi_index index.php;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
    }
    location @elgg {
        fastcgi_pass 127.0.0.1:9000;
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
        fastcgi_param SCRIPT_NAME     /index.php;
        fastcgi_param  SSL_PROTOCOL $ssl_protocol;
        fastcgi_param QUERY_STRING    __elgg_uri=$uri&$args;
    }

0 个答案:

没有答案