Using environment vars in nginx-site.conf #128

Closed
opened 2017-03-17 22:01:41 +00:00 by roddypratt · 2 comments
roddypratt commented 2017-03-17 22:01:41 +00:00 (Migrated from github.com)

I'm trying and failing to do something like this in my nginx config.

env WSHOST;
...
set_by_lua_block $wshost { os.getenv("WSHOST") }
proxy_pass "http://" + $wshost; 

Problem is that 'env' can't be used here because we're not at the top level of the .conf file.

nginx: [emerg] "env" directive is not allowed here in /etc/nginx/sites-enabled/default.conf:1

Ideally I'd be able to have a local version of nginx.conf in /var/wwww/html/conf, as well as the individual sites-enabled files. Does that suggestion make any sense?

(Also http_lua_module isn't included, but I guess I can use perl instead...)

I'm trying and failing to do something like this in my nginx config. ``` env WSHOST; ... set_by_lua_block $wshost { os.getenv("WSHOST") } proxy_pass "http://" + $wshost; ``` Problem is that 'env' can't be used here because we're not at the top level of the .conf file. `nginx: [emerg] "env" directive is not allowed here in /etc/nginx/sites-enabled/default.conf:1` Ideally I'd be able to have a local version of nginx.conf in /var/wwww/html/conf, as well as the individual sites-enabled files. Does that suggestion make any sense? (Also http_lua_module isn't included, but I guess I can use perl instead...)
richarvey commented 2017-03-23 16:08:06 +00:00 (Migrated from github.com)

Makes sense we'll look into it

Makes sense we'll look into it
richarvey commented 2017-08-18 13:57:24 +00:00 (Migrated from github.com)

hi @roddypratt lua support is coming in 1.30, I'm doing final testing now and will push the release version shortly

hi @roddypratt lua support is coming in 1.30, I'm doing final testing now and will push the release version shortly
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ric/nginx-php-fpm#128
No description provided.