Klaus Demo nginx / a1df416
--sysconfdir=DIR Igor Sysoev 15 years ago
17 changed file(s) with 64 addition(s) and 42 deletion(s). Raw diff Collapse all Expand all
6666
6767 have=NGX_PREFIX value="\"$NGX_PREFIX/\"" . auto/define
6868 have=NGX_SBIN_PATH value="\"$NGX_SBIN_PATH\"" . auto/define
69 have=NGX_CONF_PREFIX value="\"$NGX_CONF_PREFIX/\"" . auto/define
6970 have=NGX_CONF_PATH value="\"$NGX_CONF_PATH\"" . auto/define
7071 have=NGX_PID_PATH value="\"$NGX_PID_PATH\"" . auto/define
7172 have=NGX_LOCK_PATH value="\"$NGX_LOCK_PATH\"" . auto/define
2525 test ! -f '$NGX_SBIN_PATH' || mv '$NGX_SBIN_PATH' '$NGX_SBIN_PATH.old'
2626 cp $NGX_OBJS/nginx '$NGX_SBIN_PATH'
2727
28 test -d '`dirname "$NGX_CONF_PATH"`' \
29 || mkdir -p '`dirname "$NGX_CONF_PATH"`'
28 test -d '$NGX_CONF_PREFIX' || mkdir -p '$NGX_CONF_PREFIX'
3029
31 cp conf/koi-win '`dirname "$NGX_CONF_PATH"`'
32 cp conf/koi-utf '`dirname "$NGX_CONF_PATH"`'
33 cp conf/win-utf '`dirname "$NGX_CONF_PATH"`'
30 cp conf/koi-win '$NGX_CONF_PREFIX'
31 cp conf/koi-utf '$NGX_CONF_PREFIX'
32 cp conf/win-utf '$NGX_CONF_PREFIX'
3433
35 test -f '`dirname "$NGX_CONF_PATH"`/mime.types' || \
36 cp conf/mime.types '`dirname "$NGX_CONF_PATH"`/mime.types'
37 cp conf/mime.types '`dirname "$NGX_CONF_PATH"`/mime.types.default'
34 test -f '$NGX_CONF_PREFIX/mime.types' \
35 || cp conf/mime.types '$NGX_CONF_PREFIX'
36 cp conf/mime.types '$NGX_CONF_PATH/mime.types.default'
3837
39 test -f '$NGX_CONF_PATH' || cp conf/nginx.conf '$NGX_CONF_PATH'
40 cp conf/nginx.conf '`dirname "$NGX_CONF_PATH"`/nginx.conf.default'
38 test -f '$NGX_CONF_PREFIX/fastcgi_params' \
39 || cp conf/fastcgi_params '$NGX_CONF_PREFIX'
40 cp conf/fastcgi_params '$NGX_CONF_PATH/fastcgi_params.default'
41
42 test -f '$NGX_CONF_PATH' || cp conf/nginx.conf '$NGX_CONF_PREFIX'
43 cp conf/nginx.conf '$NGX_CONF_PREFIX/nginx.conf.default'
4144
4245 test -d '`dirname "$NGX_PID_PATH"`' \
4346 || mkdir -p '`dirname "$NGX_PID_PATH"`'
55
66 NGX_PREFIX=
77 NGX_SBIN_PATH=
8 NGX_CONF_PREFIX=
89 NGX_CONF_PATH=
910 NGX_ERROR_LOG_PATH=
1011 NGX_PID_PATH=
122123
123124 --prefix=*) NGX_PREFIX="$value" ;;
124125 --sbin-path=*) NGX_SBIN_PATH="$value" ;;
126 --sysconfdir=*) NGX_CONF_PREFIX="$value" ;;
125127 --conf-path=*) NGX_CONF_PATH="$value" ;;
126128 --error-log-path=*) NGX_ERROR_LOG_PATH="$value";;
127129 --pid-path=*) NGX_PID_PATH="$value" ;;
239241
240242 --prefix=PATH set the installation prefix
241243 --sbin-path=PATH set path to the nginx binary file
244 --sysconfdir=PATH set the configuration prefix
242245 --conf-path=PATH set path to the nginx.conf file
243246 --error-log-path=PATH set path to the error log
244247 --pid-path=PATH set path to nginx.pid file
359362
360363
361364 NGX_PREFIX=${NGX_PREFIX:-/usr/local/nginx}
365 NGX_CONF_PREFIX=${NGX_CONF_PREFIX:-$NGX_PREFIX}
362366
363367
364368 case ".$NGX_SBIN_PATH" in
380384 ;;
381385
382386 .)
383 NGX_CONF_PATH=$NGX_PREFIX/conf/nginx.conf
384 ;;
385
386 *)
387 NGX_CONF_PATH=$NGX_PREFIX/$NGX_CONF_PATH
387 NGX_CONF_PATH=$NGX_CONF_PREFIX/conf/nginx.conf
388 ;;
389
390 *)
391 NGX_CONF_PATH=$NGX_CONF_PREFIX/$NGX_CONF_PATH
388392 ;;
389393 esac
390394
147147 cat << END
148148 nginx path prefix: "$NGX_PREFIX"
149149 nginx binary file: "$NGX_SBIN_PATH"
150 nginx configuration prefix: "$NGX_CONF_PREFIX"
150151 nginx configuration file: "$NGX_CONF_PATH"
151152 nginx pid file: "$NGX_PID_PATH"
152153 END
655655 cycle->conf_file.data = (u_char *) NGX_CONF_PATH;
656656 }
657657
658 if (ngx_conf_full_name(cycle, &cycle->conf_file) == NGX_ERROR) {
658 if (ngx_conf_full_name(cycle, &cycle->conf_file, 1) == NGX_ERROR) {
659659 return NGX_ERROR;
660660 }
661661
825825 ccf->pid.data = (u_char *) NGX_PID_PATH;
826826 }
827827
828 if (ngx_conf_full_name(cycle, &ccf->pid) == NGX_ERROR) {
828 if (ngx_conf_full_name(cycle, &ccf->pid, 0) == NGX_ERROR) {
829829 return NGX_CONF_ERROR;
830830 }
831831
845845 ccf->lock_file.data = (u_char *) NGX_LOCK_PATH;
846846 }
847847
848 if (ngx_conf_full_name(cycle, &ccf->lock_file) == NGX_ERROR) {
848 if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) == NGX_ERROR) {
849849 return NGX_CONF_ERROR;
850850 }
851851
640640
641641 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
642642
643 if (ngx_conf_full_name(cf->cycle, &file) == NGX_ERROR) {
643 if (ngx_conf_full_name(cf->cycle, &file, 1) == NGX_ERROR) {
644644 return NGX_CONF_ERROR;
645645 }
646646
680680
681681
682682 ngx_int_t
683 ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name)
684 {
685 u_char *p;
683 ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name, ngx_uint_t conf_prefix)
684 {
685 size_t len;
686 u_char *p, *prefix;
686687 ngx_str_t old;
687688
688689 if (name->data[0] == '/') {
703704
704705 old = *name;
705706
706 name->len = cycle->root.len + old.len;
707
707 if (conf_prefix) {
708 len = sizeof(NGX_CONF_PREFIX) - 1;
709 prefix = (u_char *) NGX_CONF_PREFIX;
710
711 } else {
712 len = cycle->root.len;
713 prefix = cycle->root.data;
714 }
715
716 name->len = len + old.len;
708717 name->data = ngx_palloc(cycle->pool, name->len + 1);
709718 if (name->data == NULL) {
710719 return NGX_ERROR;
711720 }
712721
713 p = ngx_cpymem(name->data, cycle->root.data, cycle->root.len),
722 p = ngx_cpymem(name->data, prefix, len);
714723 ngx_cpystrn(p, old.data, old.len + 1);
715724
716725 return NGX_OK;
733742 if (name) {
734743 full = *name;
735744
736 if (ngx_conf_full_name(cycle, &full) == NGX_ERROR) {
745 if (ngx_conf_full_name(cycle, &full, 0) == NGX_ERROR) {
737746 return NULL;
738747 }
739748
319319 char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename);
320320
321321
322 ngx_int_t ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name);
322 ngx_int_t ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name,
323 ngx_uint_t conf_prefix);
323324 ngx_open_file_t *ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name);
324325 void ngx_cdecl ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf,
325326 ngx_err_t err, char *fmt, ...);
259259 path->name.len--;
260260 }
261261
262 if (ngx_conf_full_name(cf->cycle, &path->name) == NGX_ERROR) {
262 if (ngx_conf_full_name(cf->cycle, &path->name, 0) == NGX_ERROR) {
263263 return NULL;
264264 }
265265
108108 curr->name.len = sizeof(path) - 1; \
109109 curr->name.data = (u_char *) path; \
110110 \
111 if (ngx_conf_full_name(cf->cycle, &curr->name) == NGX_ERROR) { \
111 if (ngx_conf_full_name(cf->cycle, &curr->name, 0) == NGX_ERROR) { \
112112 return NGX_CONF_ERROR; \
113113 } \
114114 \
332332 } else {
333333 cf->cycle->new_log->file->name = value[1];
334334
335 if (ngx_conf_full_name(cf->cycle, &cf->cycle->new_log->file->name)
335 if (ngx_conf_full_name(cf->cycle, &cf->cycle->new_log->file->name, 0)
336336 == NGX_ERROR)
337337 {
338338 return NGX_CONF_ERROR;
197197 ngx_ssl_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *cert,
198198 ngx_str_t *key)
199199 {
200 if (ngx_conf_full_name(cf->cycle, cert) == NGX_ERROR) {
200 if (ngx_conf_full_name(cf->cycle, cert, 1) == NGX_ERROR) {
201201 return NGX_ERROR;
202202 }
203203
210210 return NGX_ERROR;
211211 }
212212
213 if (ngx_conf_full_name(cf->cycle, key) == NGX_ERROR) {
213 if (ngx_conf_full_name(cf->cycle, key, 1) == NGX_ERROR) {
214214 return NGX_ERROR;
215215 }
216216
241241 return NGX_OK;
242242 }
243243
244 if (ngx_conf_full_name(cf->cycle, cert) == NGX_ERROR) {
244 if (ngx_conf_full_name(cf->cycle, cert, 1) == NGX_ERROR) {
245245 return NGX_ERROR;
246246 }
247247
351351 }
352352
353353 if (conf->user_file.data) {
354 if (ngx_conf_full_name(cf->cycle, &conf->user_file) != NGX_OK) {
354 if (ngx_conf_full_name(cf->cycle, &conf->user_file, 1) != NGX_OK) {
355355 return NGX_CONF_ERROR;
356356 }
357357
197197 if (ngx_strcmp(value[0].data, "include") == 0) {
198198 file = value[1];
199199
200 if (ngx_conf_full_name(cf->cycle, &file) == NGX_ERROR){
200 if (ngx_conf_full_name(cf->cycle, &file, 1) == NGX_ERROR){
201201 return NGX_CONF_ERROR;
202202 }
203203
377377 if (ngx_strcmp(value[0].data, "include") == 0) {
378378 file = value[1];
379379
380 if (ngx_conf_full_name(cf->cycle, &file) == NGX_ERROR){
380 if (ngx_conf_full_name(cf->cycle, &file, 1) == NGX_ERROR){
381381 return NGX_CONF_ERROR;
382382 }
383383
453453 #endif
454454
455455 if (pmcf->modules.data) {
456 if (ngx_conf_full_name(cf->cycle, &pmcf->modules) != NGX_OK) {
456 if (ngx_conf_full_name(cf->cycle, &pmcf->modules, 0) != NGX_OK) {
457457 return NGX_CONF_ERROR;
458458 }
459459 }
12221222 return NULL;
12231223 }
12241224
1225 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, path) == NGX_ERROR) {
1225 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, path, 0)== NGX_ERROR)
1226 {
12261227 return NULL;
12271228 }
12281229
19461947 if (ngx_strcmp(value[0].data, "include") == 0) {
19471948 file = value[1];
19481949
1949 if (ngx_conf_full_name(cf->cycle, &file) == NGX_ERROR){
1950 if (ngx_conf_full_name(cf->cycle, &file, 1) == NGX_ERROR){
19501951 return NGX_CONF_ERROR;
19511952 }
19521953
22892290 conf->root.len = sizeof("html") - 1;
22902291 conf->root.data = (u_char *) "html";
22912292
2292 if (ngx_conf_full_name(cf->cycle, &conf->root) == NGX_ERROR) {
2293 if (ngx_conf_full_name(cf->cycle, &conf->root, 0) == NGX_ERROR) {
22932294 return NGX_CONF_ERROR;
22942295 }
22952296 }
27382739 }
27392740
27402741 if (lcf->root.data[0] != '$') {
2741 if (ngx_conf_full_name(cf->cycle, &lcf->root) == NGX_ERROR) {
2742 if (ngx_conf_full_name(cf->cycle, &lcf->root, 0) == NGX_ERROR) {
27422743 return NGX_CONF_ERROR;
27432744 }
27442745 }
925925 return NGX_ERROR;
926926 }
927927
928 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &path) == NGX_ERROR) {
928 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &path, 0)
929 == NGX_ERROR)
930 {
929931 return NGX_ERROR;
930932 }
931933