9 messages in ru.sysoev.nginxRe: nginx-0.7.4
FromSent OnAttachments
Igor SysoevJun 30, 2008 5:43 am 
Phillip B OldhamJun 30, 2008 5:59 am 
Igor SysoevJun 30, 2008 6:21 am 
Manlio PerilloJun 30, 2008 6:42 am.patch
mikeJun 30, 2008 8:33 am 
RoxisJun 30, 2008 10:27 am 
Sean AllenJun 30, 2008 10:34 am 
Ed WJun 30, 2008 10:51 am 
Cliff WellsJun 30, 2008 12:45 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: nginx-0.7.4Actions...
From:Manlio Perillo (manl@public.gmane.org)
Date:Jun 30, 2008 6:42:57 am
List:ru.sysoev.nginx
Attachments:

Igor Sysoev ha scritto:

On Mon, Jun 30, 2008 at 01:59:38PM +0100, Phillip B Oldham wrote:

The -g switch? Any more details on this? There's nothing in the wiki yet: http://wiki.codemongers.com/NginxCommandLine

The -g switch allow to set global directive in command line, e.g.:

nginx -g "pid /var/run/nginx.pid; worker_processes `sysctl -n hw.ncpu`;"

Note the semicolon after last directive.

By the way, some time ago, I wrote a patch with the implementation of a new switch -p.

It allows to set the prefix path in command line.

Regards Manlio Perillo

diff -r d56189ba97a1 src/core/nginx.c --- a/src/core/nginx.c Tue Jan 22 12:03:43 2008 +0100 +++ b/src/core/nginx.c Tue Jan 22 15:15:15 2008 +0100 @@ -632,6 +632,18 @@ ngx_getopt(ngx_cycle_t *cycle, int argc, ngx_test_config = 1; break;

+ case 'p': + if (argv[i + 1] == NULL) { + ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, + "the option: \"%s\" requires directory name", + argv[i]); + return NGX_ERROR; + } + + cycle->root.data = (u_char *) argv[++i]; + cycle->root.len = ngx_strlen(cycle->root.data); + break; + case 'c': if (argv[i + 1] == NULL) { ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, @@ -649,6 +661,11 @@ ngx_getopt(ngx_cycle_t *cycle, int argc, "invalid option: \"%s\"", argv[i]); return NGX_ERROR; } + } + + if (cycle->root.data == NULL) { + cycle->root.len = sizeof(NGX_PREFIX) - 1; + cycle->root.data = (u_char *) NGX_PREFIX; }

if (cycle->conf_file.data == NULL) { diff -r d56189ba97a1 src/core/ngx_cycle.c --- a/src/core/ngx_cycle.c Tue Jan 22 12:03:43 2008 +0100 +++ b/src/core/ngx_cycle.c Tue Jan 22 15:15:15 2008 +0100 @@ -74,9 +74,16 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) cycle->pool = pool; cycle->log = log; cycle->old_cycle = old_cycle; - cycle->root.len = sizeof(NGX_PREFIX) - 1; - cycle->root.data = (u_char *) NGX_PREFIX;

+ + cycle->root.len = old_cycle->root.len; + cycle->root.data = ngx_palloc(pool, old_cycle->root.len + 1); + if (cycle->root.data == NULL) { + ngx_destroy_pool(pool); + return NULL; + } + ngx_cpystrn(cycle->root.data, old_cycle->root.data, + old_cycle->root.len + 1);

cycle->conf_file.len = old_cycle->conf_file.len; cycle->conf_file.data = ngx_palloc(pool, old_cycle->conf_file.len + 1);