[oe-commits] [meta-openembedded] 05/15: nginx: update systemd unit using nginx recommendation

git at git.openembedded.org git at git.openembedded.org
Sun Jan 20 18:16:19 UTC 2019


This is an automated email from the git hooks/post-receive script.

khem pushed a commit to branch master-next
in repository meta-openembedded.

commit a0eadda9106a22b1d7a7c98c4a97c8329171540f
Author: André Draszik <andre.draszik at jci.com>
AuthorDate: Fri Jan 18 14:26:10 2019 +0000

    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 at jci.com>
    Signed-off-by: Khem Raj <raj.khem at gmail.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 ce99061..c6fc049 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 24c2ced..ea1c1f7 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, at SYSCONFDIR@,${sysconfdir},g' \
             -e 's, at LOCALSTATEDIR@,${localstatedir},g' \
             -e 's, at SBINDIR@,${sbindir},g' \
+            -e 's, at BINDIR@,${bindir},g' \
             ${D}${systemd_unitdir}/system/nginx.service
     fi
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list