Join the community today
Become a Member

PHP-FPM $_SERVER['HTTPS'] variable

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Sunka, Jan 13, 2017.

  1. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    1:57 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    Please fill in any relevant information that applies to you:
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.11.8
    • PHP Version Installed: 7.1
    • MariaDB MySQL Version Installed: 10.1.20
    • When was last time updated Centmin Mod code base ? : today

    Under the PHP Variables section on my phpinfo.php page, variable $_SERVER['HTTPS'] is set to OFF, but my forum and all on server is on https.
    I also tried to add $_SERVER['HTTPS'] = 'on'; in my library/config.php file of XenForo forum, but still no luck.

    I google for that problem and found this:

    Is that a good solution?

     
  2. eva2000

    eva2000 Administrator Staff Member

    54,909
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:57 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    I believe it's already done in Centmin Mod Nginx / php-fpm via 2 variables in /usr/local/nginx/conf/php.conf

    Code (Text):
    fastcgi_param  HTTPS              $https if_not_empty;
    

    and
    Code (Text):
    fastcgi_param HTTPS $server_https;
    

    with nginx.conf include file
    Code (Text):
    include /usr/local/nginx/conf/fastcgi_param_https_map.conf;
    

    contents
    Code (Text):
    # auto detect and enable fastcgi_param HTTPS $server_http
    # for PHP behind SSL https
    
    map $scheme $server_https {
            default off;
            https on;
    }
    


    it only shows as on in phpinfo if you access phpinfo url from https otherwise if you access via non-https it shows off
     
  3. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    1:57 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    Aha, so it is https (y)
    Yep, I tried to open phpinfo with https and it is show ON.

    So, conclusion, server is HTTPS?
    I can sleep in peace?
     
  4. eva2000

    eva2000 Administrator Staff Member

    54,909
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:57 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yup