From: "André Draszik" <git@andred.net>
To: openembedded-devel@lists.openembedded.org
Subject: [meta-webserver][PATCH 1/2] nginx: update systemd unit using nginx recommendation
Date: Fri, 18 Jan 2019 14:26:10 +0000 [thread overview]
Message-ID: <20190118142611.21544-1-git@andred.net> (raw)
From: André Draszik <andre.draszik@jci.com>
Our systemd unit doesn't follow the official
recommendation, see
https://www.nginx.com/resources/wiki/start/topics/examples/systemd/
Most importantly:
* it should start after some additional specific
targets/units
* using PrivateTmp is a useful security feature, in
particular to avoid cross domain scripting via the
temp folder
* using systemd's $MAINPID, we can distinguish between
multiple running nginx instances correctly
Signed-off-by: André Draszik <andre.draszik@jci.com>
---
meta-webserver/recipes-httpd/nginx/files/nginx.service | 10 +++++++---
meta-webserver/recipes-httpd/nginx/nginx.inc | 1 +
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/meta-webserver/recipes-httpd/nginx/files/nginx.service b/meta-webserver/recipes-httpd/nginx/files/nginx.service
index ce9906171..c6fc0495f 100644
--- a/meta-webserver/recipes-httpd/nginx/files/nginx.service
+++ b/meta-webserver/recipes-httpd/nginx/files/nginx.service
@@ -1,11 +1,15 @@
[Unit]
-Description=Nginx Server
-After=network.target
+Description=The NGINX HTTP and reverse proxy server
+After=syslog.target network.target remote-fs.target nss-lookup.target
+
[Service]
Type=forking
PIDFile=/run/nginx/nginx.pid
+ExecStartPre=@SBINDIR@/nginx -t
ExecStart=@SBINDIR@/nginx
-ExecStop=@SBINDIR@/nginx -s stop
ExecReload=@SBINDIR@/nginx -s reload
+ExecStop=@BINDIR@/kill -s QUIT $MAINPID
+PrivateTmp=true
+
[Install]
WantedBy=multi-user.target
diff --git a/meta-webserver/recipes-httpd/nginx/nginx.inc b/meta-webserver/recipes-httpd/nginx/nginx.inc
index 24c2cedf5..ea1c1f782 100644
--- a/meta-webserver/recipes-httpd/nginx/nginx.inc
+++ b/meta-webserver/recipes-httpd/nginx/nginx.inc
@@ -117,6 +117,7 @@ do_install () {
sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
-e 's,@LOCALSTATEDIR@,${localstatedir},g' \
-e 's,@SBINDIR@,${sbindir},g' \
+ -e 's,@BINDIR@,${bindir},g' \
${D}${systemd_unitdir}/system/nginx.service
fi
}
--
2.20.1
next reply other threads:[~2019-01-18 14:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-18 14:26 André Draszik [this message]
2019-01-18 14:26 ` [meta-webserver][PATCH 2/2] nginx: configuration update André Draszik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190118142611.21544-1-git@andred.net \
--to=git@andred.net \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox