Get the most out of your Centmin Mod LEMP stack
Become a Member

Trying to figure out how to port an Apache SetEnv to NGINX in Centmin

Discussion in 'Other Web Apps usage' started by fly, Mar 8, 2023.

  1. fly

    fly Premium Member Premium Member

    68
    13
    8
    Jul 27, 2019
    Ratings:
    +20
    Local Time:
    6:18 PM
    I'm (clearly) not so good with some of the configuration changes needed to move from Apache to NGINX. One of them is where to put a SetEnv setting for a site.

     
  2. eva2000

    eva2000 Administrator Staff Member

    49,869
    11,482
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,834
    Local Time:
    8:18 AM
    Nginx 1.21.x
    MariaDB 10.x
    What are you trying to do?
     
  3. fly

    fly Premium Member Premium Member

    68
    13
    8
    Jul 27, 2019
    Ratings:
    +20
    Local Time:
    6:18 PM
    So in Apache, an .htaccess file sets the environment with

    Code:
    SetEnv CI_ENV development
    According to Google, I *think* I can set that with a fastcgi_param, but haven't tested it.
     
  4. eva2000

    eva2000 Administrator Staff Member

    49,869
    11,482
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,834
    Local Time:
    8:18 AM
    Nginx 1.21.x
    MariaDB 10.x
    Yes you use fastcgi_param if you want PHP-FPM to read the set environmental variable and not Nginx. If you want Nginx to read, use env variable Core functionality
     
  5. fly

    fly Premium Member Premium Member

    68
    13
    8
    Jul 27, 2019
    Ratings:
    +20
    Local Time:
    6:18 PM
    How in the heck did that not come up in my Google search? :dead:

    Hmm, that says I can only put it in main though. I will have multiple environments on the same server. Is the result the same no matter where it's set? If it matters, its obviously running PHP code.