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/recipes-httpd | |
parent | d417b693a5f4d74aa1ade1e58e3363db18901c85 (diff) | |
download | meta-openembedded-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/recipes-httpd')
-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 ce99061717..c6fc0495f1 100644 --- a/meta-webserver/recipes-httpd/nginx/files/nginx.service +++ b/meta-webserver/recipes-httpd/nginx/files/nginx.service | |||
@@ -1,11 +1,15 @@ | |||
1 | [Unit] | 1 | [Unit] |
2 | Description=Nginx Server | 2 | Description=The NGINX HTTP and reverse proxy server |
3 | After=network.target | 3 | After=syslog.target network.target remote-fs.target nss-lookup.target |
4 | |||
4 | [Service] | 5 | [Service] |
5 | Type=forking | 6 | Type=forking |
6 | PIDFile=/run/nginx/nginx.pid | 7 | PIDFile=/run/nginx/nginx.pid |
8 | ExecStartPre=@SBINDIR@/nginx -t | ||
7 | ExecStart=@SBINDIR@/nginx | 9 | ExecStart=@SBINDIR@/nginx |
8 | ExecStop=@SBINDIR@/nginx -s stop | ||
9 | ExecReload=@SBINDIR@/nginx -s reload | 10 | ExecReload=@SBINDIR@/nginx -s reload |
11 | ExecStop=@BINDIR@/kill -s QUIT $MAINPID | ||
12 | PrivateTmp=true | ||
13 | |||
10 | [Install] | 14 | [Install] |
11 | WantedBy=multi-user.target | 15 | WantedBy=multi-user.target |
diff --git a/meta-webserver/recipes-httpd/nginx/nginx.inc b/meta-webserver/recipes-httpd/nginx/nginx.inc index 24c2cedf5f..ea1c1f782a 100644 --- a/meta-webserver/recipes-httpd/nginx/nginx.inc +++ b/meta-webserver/recipes-httpd/nginx/nginx.inc | |||
@@ -117,6 +117,7 @@ do_install () { | |||
117 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \ | 117 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \ |
118 | -e 's,@LOCALSTATEDIR@,${localstatedir},g' \ | 118 | -e 's,@LOCALSTATEDIR@,${localstatedir},g' \ |
119 | -e 's,@SBINDIR@,${sbindir},g' \ | 119 | -e 's,@SBINDIR@,${sbindir},g' \ |
120 | -e 's,@BINDIR@,${bindir},g' \ | ||
120 | ${D}${systemd_unitdir}/system/nginx.service | 121 | ${D}${systemd_unitdir}/system/nginx.service |
121 | fi | 122 | fi |
122 | } | 123 | } |