Get the most out of your Centmin Mod LEMP stack
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,003
    276
    83
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +453
    Local Time:
    2:03 PM
    Nginx 1.15.0
    MariaDB 10.2.15
    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

    36,055
    7,910
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,192
    Local Time:
    10:03 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    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 Well-Known Member

    1,003
    276
    83
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +453
    Local Time:
    2:03 PM
    Nginx 1.15.0
    MariaDB 10.2.15
    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

    36,055
    7,910
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,192
    Local Time:
    10:03 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    yup
     
    • Like Like x 1
..