diff options
author | André Draszik <andre.draszik@jci.com> | 2019-01-18 14:26:10 +0000 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2019-01-19 10:06:20 -0800 |
commit | a0eadda9106a22b1d7a7c98c4a97c8329171540f (patch) | |
tree | 91d8b58ab216868b1fa46affd2dc28625f713aa3 /meta-webserver | |
parent | d417b693a5f4d74aa1ade1e58e3363db18901c85 (diff) | |
download | meta-openembedded-contrib-a0eadda9106a22b1d7a7c98c4a97c8329171540f.tar.gz |
nginx: update systemd unit using nginx recommendation
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>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-webserver')
-rw-r--r-- | meta-webserver/recipes-httpd/nginx/files/nginx.service | 10 | ||||
-rw-r--r-- | 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 ce99061717b..c6fc0495f1a 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 24c2cedf5fe..ea1c1f782a7 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 } |