summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Nagy <robert@cvs.openbsd.org>2011-10-05 18:04:19 +0000
committerRobert Nagy <robert@cvs.openbsd.org>2011-10-05 18:04:19 +0000
commit1ca65fb6f6f9899871abb1cfcc6c58fc2410d460 (patch)
tree49ced0deaee10678ec92b900913d209db7405cce
parentd941545181488ae1ee9093f68f68cf795ce10894 (diff)
Since the worker process of nginx is chrooted on OpenBSD, let's remove
down the prefix of nginx which is /var/www from the file paths when the worker process tries to reopen files (access.log, error.log, etc.). This fixes the 'nginx -s reopen' issue which was reported by some users.
-rw-r--r--usr.sbin/nginx/Makefile.bsd-wrapper8
-rw-r--r--usr.sbin/nginx/src/core/ngx_cycle.c4
2 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/nginx/Makefile.bsd-wrapper b/usr.sbin/nginx/Makefile.bsd-wrapper
index e19974914ca..6b90d90ba95 100644
--- a/usr.sbin/nginx/Makefile.bsd-wrapper
+++ b/usr.sbin/nginx/Makefile.bsd-wrapper
@@ -1,17 +1,17 @@
# Build wrapper for Nginx
-# $OpenBSD: Makefile.bsd-wrapper,v 1.2 2011/09/24 20:13:57 robert Exp $
+# $OpenBSD: Makefile.bsd-wrapper,v 1.3 2011/10/05 18:04:18 robert Exp $
LNDIR= /usr/bin/lndir
.include <bsd.own.mk>
-CONFIGURE_ARGS= --prefix=/etc/nginx \
+CONFIGURE_ARGS= --prefix=/var/www \
--conf-path=/etc/nginx/nginx.conf \
--sbin-path=/usr/sbin/nginx \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
- --http-log-path=/var/www/logs/access.log \
- --error-log-path=/var/www/logs/error.log \
+ --http-log-path=logs/access.log \
+ --error-log-path=logs/error.log \
--http-client-body-temp-path=/tmp/client_body_temp \
--http-proxy-temp-path=/tmp/proxy_temp \
--http-fastcgi-temp-path=/tmp/fastcgi_temp \
diff --git a/usr.sbin/nginx/src/core/ngx_cycle.c b/usr.sbin/nginx/src/core/ngx_cycle.c
index 968056c42e6..ed25006e390 100644
--- a/usr.sbin/nginx/src/core/ngx_cycle.c
+++ b/usr.sbin/nginx/src/core/ngx_cycle.c
@@ -1136,6 +1136,10 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
len = file[i].pos - file[i].buffer;
+ if (ngx_process == NGX_PROCESS_WORKER)
+ ngx_cpystrn(file[i].name.data, file[i].name.data + strlen(NGX_PREFIX),
+ file[i].name.len);
+
if (file[i].buffer && len != 0) {
n = ngx_write_fd(file[i].fd, file[i].buffer, len);