Can nginx.conf use relative paths?

Hello,

I am just wondering whether it’s possible to use relative paths in the
nginx.conf, like:

[ng.conf]
include common.nginx.conf;
pid nginx.pid;
error_log error.log;

On Gentoo’s nginx-0.7.7 I get

/tmp/ng $ /usr/sbin/nginx -c ng.conf
2008/08/26 13:24:18 [emerg] 14352#0: open() “/etc/nginx/common.conf”
failed (2: No such file or directory) in ng.conf:1

(Common.nginx.conf is actually in the cwd.)

Any ideas besides using absolute paths?

Best,

Sven

Should work fine with files in same directory. Check your spelling and
names and file permissions because your error message here doesn’t match
the contents of example file.
common.nginx.conf not same as common.conf

On Tuesday 26 August 2008, Sven C. Koehler wrote:

| 2008/08/26 15:32:55 [emerg] 14789#0: open() “/etc/nginx/common.conf”
-S.
nginx don’t uses cwd but path selected by configure script
in your case it is “/etc/nginx”

so “include common.conf;” will include “/etc/nginx/common.conf”
and not “$PWD/common.conf”

On Tue, Aug 26, 2008 at 03:32:34PM +0200, Sven C. Koehler wrote:

/tmp/ng $ /usr/sbin/nginx -c ng.conf
2008/08/26 13:24:18 [emerg] 14352#0: open() “/etc/nginx/common.conf”
failed (2: No such file or directory) in ng.conf:1

(Common.nginx.conf is actually in the cwd.)

Any ideas besides using absolute paths?

The paths in configuration depending on directive may be relative to

  1. built time nginx.conf path
  2. or built time server prefix path.

On Tue, Aug 26, 2008 at 10:16:19PM +0700, Chris S. wrote:

common.nginx.conf not same as common.conf

Ok, I fixed the spelling, but the error remains:

| /tmp/ng $ cat ng.conf
| include common.conf;
| pid nginx.pid;
| /tmp/ng $ cat common.conf
| # empty
| /tmp/ng $ /usr/sbin/nginx -c ng.conf
| 2008/08/26 15:32:55 [emerg] 14789#0: open() “/etc/nginx/common.conf”
| failed (2: No such file or directory) in ng.conf:1
| /tmp/ng $ /usr/sbin/nginx -v
| nginx version: nginx/0.7.7

The wiki documentation on
http://wiki.codemongers.com/NginxMainModule#include says that “since
version 0.6.7, paths are relative to directory of nginx configuration
file nginx.conf, but not to nginx prefix directory.” – so could it be
that nginx is broken on Gentoo?

-S.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs