Skip to content

Using environment vars in nginx-site.conf #128

@roddypratt

Description

@roddypratt

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...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions