Join the community today
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 Member

    109
    16
    18
    Jul 27, 2019
    Ratings:
    +28
    Local Time:
    5:02 AM
    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

    51,616
    11,933
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,420
    Local Time:
    7:02 PM
    Nginx 1.25.x
    MariaDB 10.x
    What are you trying to do?
     
  3. fly

    fly Member

    109
    16
    18
    Jul 27, 2019
    Ratings:
    +28
    Local Time:
    5:02 AM
    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

    51,616
    11,933
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,420
    Local Time:
    7:02 PM
    Nginx 1.25.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 Member

    109
    16
    18
    Jul 27, 2019
    Ratings:
    +28
    Local Time:
    5:02 AM
    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.