Want more timely Centmin Mod News Updates?
Become a Member

PHP-FPM $_SERVER['HTTPS'] variable

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

  1. Sunka

    Sunka Active Member

    917
    240
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +388
    Local Time:
    5:08 PM
    Nginx 1.13.3
    MariaDB 10.1.24
    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

    30,151
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    1:08 AM
    Nginx 1.13.x
    MariaDB 5.5
    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
     
    • Winner Winner x 1
  3. Sunka

    Sunka Active Member

    917
    240
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +388
    Local Time:
    5:08 PM
    Nginx 1.13.3
    MariaDB 10.1.24
    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

    30,151
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    1:08 AM
    Nginx 1.13.x
    MariaDB 5.5
    yup
     
    • Like Like x 1