Skip to contentSkip to conversation

package/nginx: use CacheDirectory

PATCH New Pascal de Bruijn 2 participants 2 messages Jan 23, 2020 – Jan 5, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/nginx: use CacheDirectory

move
http-client-body-temp-path
http-proxy-temp-path
http-fastcgi-temp-path
http-scgi-temp-path
http-uwsgi-temp-path

from /var/tmp/nginx to /var/cache/nginx

this allows the use of systemd constructs

LogsDirectory=nginx
CacheDirectory=nginx

to replace

ExecStartPre=/usr/bin/mkdir -p /var/log/nginx /var/tmp/nginx

as there isn't similar construct for /var/tmp

---
 package/nginx/S50nginx      |  2 +-
 package/nginx/nginx.mk      | 10 +++++-----
 package/nginx/nginx.service |  3 ++-
 3 files changed, 8 insertions(+), 7 deletions(-)
package/nginx/S50nginx +1 -1
index 964652b..6c243f4 100644
@@ -9,7 +9,7 @@ PIDFILE=/var/run/nginx.pid
 case "$1" in
   start)
 	echo "Starting nginx..."
-	mkdir -p /var/log/nginx /var/tmp/nginx
+	mkdir -p /var/log/nginx /var/cache/nginx
 	start-stop-daemon -S -x "$NGINX" -p "$PIDFILE"
 	;;
   stop)
package/nginx/nginx.mk +5 -5
index 59fddbb..bb8c57a 100644
@@ -56,11 +56,11 @@ NGINX_CONF_OPTS += \
 	--group=www-data \
 	--error-log-path=/var/log/nginx/error.log \
 	--http-log-path=/var/log/nginx/access.log \
-	--http-client-body-temp-path=/var/tmp/nginx/client-body \
-	--http-proxy-temp-path=/var/tmp/nginx/proxy \
-	--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \
-	--http-scgi-temp-path=/var/tmp/nginx/scgi \
-	--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi
+	--http-client-body-temp-path=/var/cache/nginx/client-body \
+	--http-proxy-temp-path=/var/cache/nginx/proxy \
+	--http-fastcgi-temp-path=/var/cache/nginx/fastcgi \
+	--http-scgi-temp-path=/var/cache/nginx/scgi \
+	--http-uwsgi-temp-path=/var/cache/nginx/uwsgi
 
 NGINX_CONF_OPTS += \
 	$(if $(BR2_PACKAGE_NGINX_FILE_AIO),--with-file-aio) \
package/nginx/nginx.service +2 -1
index 320df9a..3f6cd12 100644
@@ -4,8 +4,9 @@ After=syslog.target network.target
 
 [Service]
 Type=forking
+LogsDirectory=nginx
+CacheDirectory=nginx
 PIDFile=/var/run/nginx.pid
-ExecStartPre=/usr/bin/mkdir -p /var/log/nginx /var/tmp/nginx
 ExecStartPre=/usr/sbin/nginx -t -q -g 'pid /var/run/nginx.pid; daemon on; master_process on;'
 ExecStart=/usr/sbin/nginx -g 'pid /var/run/nginx.pid; daemon on; master_process on;'
 ExecReload=/usr/sbin/nginx -g 'pid /var/run/nginx.pid; daemon on; master_process on;' -s reload
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 package/nginx: use CacheDirectory

Quoted 18 lines · On Thu, 23 Jan 2020 09:36:41 +0100 Pascal de Bruijn <[email protected]>…

move
http-client-body-temp-path
http-proxy-temp-path
http-fastcgi-temp-path
http-scgi-temp-path
http-uwsgi-temp-path

from /var/tmp/nginx to /var/cache/nginx

this allows the use of systemd constructs

LogsDirectory=nginx
CacheDirectory=nginx

to replace

ExecStartPre=/usr/bin/mkdir -p /var/log/nginx /var/tmp/nginx

Quoted 8 lines

as there isn't similar construct for /var/tmp

---
 package/nginx/S50nginx      |  2 +-
 package/nginx/nginx.mk      | 10 +++++-----
 package/nginx/nginx.service |  3 ++-
 3 files changed, 8 insertions(+), 7 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com