shell environment variables in "include"-directive not working

Markus Grobelin grobi at
Thu May 13 02:49:21 MSD 2010

Hy everybody,
i'm doing my first steps with nginx/0.8.36 and trying to get *NIX shell 
environment variables working inside the configuration files. Sadly, 
it's seems they aren't working inside the "include"-directive! :(

My current (very basic) configuration looks like this:

# user and group to run as
user $USER $USER;

# pid of nginx master process
pid /nginx/$INSTANCE/run/;

# number of nginx workers
worker_processes 2;

# number of worker connection
events {
     worker_connections 1024;

http {
     # pull in mime-types
     include /nginx/INSTANCE/nginx/conf/mime.types;

     # set a default type for the rare situation that
     # nothing matches from the mimie-type include
     default_type  application/octet-stream;

     # logging in server-context
     access_log /nginx/$INSTANCE/nginx/logs/access.log
     error_log /nginx/$INSTANCE/nginx/logs/error.log

When starting the server i got the following messages:
[alert]: could not open error log file: open() 
"/var/log/nginx/error.log" failed (13: Permission denied)
2010/05/13 00:16:38 [warn] 27977#0: the "user" directive makes sense 
only if the master process runs with super-user privileges, ignored in 
2010/05/13 00:16:38 [emerg] 27977#0: open() 
"/nginx/$INSTANCE/nginx/conf/mime.types" failed (2: No such file or 
directory) in /nginx/wally1-dach-static/nginx/conf/nginx.conf:18

The [emerg] indicates, that the $INSTANCE environment variable isn't 
expanded, whereas the "user" and "pid" directive doesn't raise an 


More information about the nginx mailing list