When upgrading nginx using pkg, NGINX_TMPDIR (usually /var/tmp/nginx) is removed. In setups relying on tmpdir this breaks the webserver (file upload, caches etc.) and therefore an immediate restart of nginx is required right after the upgrade (plus user experience might by suboptimal due to removed files). The plist already contains a fix for portmaster (which sets UPGRADE_PORT when upgrading the port): nginx/pkg-plist:@unexec if [ -z ${UPGRADE_PORT} ] ; then rm -fr %%NGINX_TMPDIR%%; fi Unfortunately this doesn't help when using pkg, so pkg install will remove /var/tmp/nginx, essentially breaking the webserver. The workaround is to set UPGRADE_PORT yourself on pkg install, e.g.: UPGRADE_PORT=nginx pkg install nginx This is not really user friendly though, so it might be better to simply not remove the temporary directory on pkg delete by default.
Created attachment 157995 [details] Patch Could you try following patch, thanks in advance.
Created attachment 158042 [details] Update patch
This gives "pkg-static: lstat(/usr/ports/www/nginx/work/stage/var/tmp/nginx/): No such file or directory" on make install, adding "${MKDIR} ${STAGEDIR}${NGINX_TMPDIR}" to do-install fixes that. I attached an updated version of the patch that adds that line. With this it works as expected (empty /var/tmp/nginx gets removed, while populated /var/tmp/nginx stays intact).
A commit references this bug: Author: osa Date: Thu Jun 25 21:06:40 UTC 2015 New revision: 390602 URL: https://svnweb.freebsd.org/changeset/ports/390602 Log: Be more accurate with tmpdir removal and remove only empty tmpdir. Cause otherwise removal non-empty tmpdir breaks running nginx instance. Bump PORTREVISION. PR: 201045 Tested by: grembo Changes: head/www/nginx/Makefile head/www/nginx/pkg-plist head/www/nginx-devel/Makefile head/www/nginx-devel/pkg-plist
Committed, thanks for report.
*** Bug 184721 has been marked as a duplicate of this bug. ***