www/nginx: Change default log locations to avoid /var/log pollution

The nginx error log default will always be touched regardless of the value
of the error_log directive in nginx.conf.  This is not a bug.  It also
breaks shell tab completion for the sane default of /var/log/nginx.

This change aligns the compiled-in default and the configuration default
of error log to a new default /var/log/nginx directory.

PR:		195916
Approved by:	maintainer timeout (15 months)
This commit is contained in:
John Marino 2016-09-06 13:57:38 +00:00
parent 724e374022
commit ef1a4679e2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=421429
4 changed files with 47 additions and 13 deletions

View file

@ -5,6 +5,19 @@ they are unavoidable.
You should get into the habit of checking this file for changes each time
you update your ports collection, before attempting any port upgrades.
20160906:
AFFECTS: uses of www/nginx
AUTHOR: marino@FreeBSD.org
Nginx now creates logs under /var/log/nginx/ and changes default log
names from "nginx-access.log" and "nginx-error.log" to "access.log" and
"error.log" respectively. This is important for the error log because
the location is encoded and touched by nginx during startup regardless
of the configured location for the error log.
See http://trac.nginx.org/nginx/ticket/147 for additional information
on why this happens.
20160905:
AFFECTS: users of databases/postgresql96-server
AUTHOR: girgen@FreeBSD.org

View file

@ -3,7 +3,7 @@
PORTNAME= nginx
PORTVERSION= 1.10.1
PORTREVISION= 1
PORTREVISION= 2
PORTEPOCH= 2
CATEGORIES= www
MASTER_SITES= http://nginx.org/download/
@ -245,13 +245,13 @@ RAKE_BIN= ${LOCALBASE}/bin/rake
.endif
NGINX_VARDIR?= /var
NGINX_LOGDIR?= ${NGINX_VARDIR}/log
NGINX_LOGDIR?= ${NGINX_VARDIR}/log/nginx
NGINX_RUNDIR?= ${NGINX_VARDIR}/run
NGINX_TMPDIR?= ${NGINX_VARDIR}/tmp/nginx
HTTP_PORT?= 80
NGINX_ACCESSLOG?= ${NGINX_LOGDIR}/nginx-access.log
NGINX_ERRORLOG?= ${NGINX_LOGDIR}/nginx-error.log
NGINX_ACCESSLOG?= ${NGINX_LOGDIR}/access.log
NGINX_ERRORLOG?= ${NGINX_LOGDIR}/error.log
CONFLICTS?= nginx-devel-1.*
USE_RC_SUBR= nginx
@ -504,7 +504,7 @@ CONFIGURE_ARGS+=--with-http_flv_module
.endif
.if ${PORT_OPTIONS:MHTTP_JSON_STATUS}
NGINX_JSON_STATUS_VERSION= 1d2f303
NGINX_JSON_STATUS_VERSION= 1d2f303
GH_ACCOUNT+= nginx-modules:json_status
GH_PROJECT+= ngx_http_json_status_module:json_status
GH_TAGNAME+= ${NGINX_JSON_STATUS_VERSION}:json_status
@ -657,7 +657,7 @@ CONFIGURE_ARGS+=--with-http_sub_module
.endif
.if ${PORT_OPTIONS:MHTTP_UPLOAD}
GIT_UPLOAD_VERSION= aba1e3f34c
GIT_UPLOAD_VERSION= aba1e3f34c
GH_ACCOUNT+= vkholodkov:upload
GH_PROJECT+= nginx-upload-module:upload
GH_TAGNAME+= ${GIT_UPLOAD_VERSION}:upload
@ -1106,7 +1106,7 @@ CONFIGURE_ARGS+=--add-module=${WRKSRC_iconv}
EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-calio-iconv-nginx-module-config
.endif
PLIST_SUB+= NGINX_TMPDIR=${NGINX_TMPDIR} WWWOWN=${WWWOWN} WWWGRP=${WWWGRP}
PLIST_SUB+= NGINX_TMPDIR=${NGINX_TMPDIR} NGINX_LOGDIR=${NGINX_LOGDIR} WWWOWN=${WWWOWN} WWWGRP=${WWWGRP}
USERS?= ${WWWOWN}
GROUPS?=${WWWGRP}
@ -1136,7 +1136,8 @@ post-extract:
post-patch:
@${REINPLACE_CMD} 's!%%HTTP_PORT%%!${HTTP_PORT}!; \
s!%%PREFIX%%!${PREFIX}!' \
s!%%PREFIX%%!${PREFIX}!; \
s!%%NGINX_ERRORLOG%%!${NGINX_ERRORLOG}!' \
${WRKSRC}/conf/nginx.conf
.if ${PORT_OPTIONS:MHTTP_ACCESSKEY}
@${REINPLACE_CMD} \
@ -1242,6 +1243,7 @@ do-install:
${MKDIR} ${STAGEDIR}${MODULESDIR}
.endif
${MKDIR} ${STAGEDIR}${NGINX_TMPDIR}
${MKDIR} ${STAGEDIR}${NGINX_LOGDIR}
${INSTALL_PROGRAM} ${WRKSRC}/objs/nginx ${STAGEDIR}${PREFIX}/sbin
.for i in koi-utf koi-win win-utf
${INSTALL_DATA} ${WRKSRC}/conf/${i} ${STAGEDIR}${ETCDIR}

View file

@ -1,6 +1,24 @@
--- conf/nginx.conf.orig Thu Jan 18 10:08:18 2007
+++ conf/nginx.conf Thu Jun 14 12:57:52 2007
@@ -33,7 +33,7 @@
--- conf/nginx.conf.orig 2016-05-31 13:47:01 UTC
+++ conf/nginx.conf
@@ -2,9 +2,14 @@
#user nobody;
worker_processes 1;
-#error_log logs/error.log;
-#error_log logs/error.log notice;
-#error_log logs/error.log info;
+# This default error log path is compiled-in to make sure configuration parsing
+# errors are logged somewhere, especially during unattended boot when stderr
+# isn't normally logged anywhere. This path will be touched on every nginx
+# start regardless of error log location configured here. See
+# https://trac.nginx.org/nginx/ticket/147 for more info.
+#
+#error_log %%NGINX_ERRORLOG%%;
+#
#pid logs/nginx.pid;
@@ -33,7 +38,7 @@ http {
#gzip on;
server {
@ -9,7 +27,7 @@
server_name localhost;
#charset koi8-r;
@@ -41,7 +41,7 @@
@@ -41,7 +46,7 @@ http {
#access_log logs/host.access.log main;
location / {
@ -18,7 +36,7 @@
index index.html index.htm;
}
@@ -51,7 +51,7 @@
@@ -51,7 +56,7 @@ http {
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {

View file

@ -15,4 +15,5 @@
%%WWWDATA%%@unexec if [ -L %D/www/nginx ]; then rm -f %D/www/nginx; fi
sbin/nginx
@dir %%NGINX_TMPDIR%%
@dir %%NGINX_LOGDIR%%
man/man8/nginx.8.gz