aboutsummaryrefslogtreecommitdiffstats
path: root/meta-webserver
diff options
context:
space:
mode:
authorSzombathelyi György <gyurco@freemail.hu>2016-08-18 15:58:34 +0200
committerMartin Jansa <Martin.Jansa@gmail.com>2016-08-22 15:52:32 +0200
commit8e6425cfa130a181b22077aa9153704c229ed4d7 (patch)
tree5b6933e007eeda19955ab7c1e64094c65cf82ee5 /meta-webserver
parent6c7c69c700f367c131ddb942f44185b474feceac (diff)
downloadmeta-openembedded-contrib-8e6425cfa130a181b22077aa9153704c229ed4d7.tar.gz
nginx: optimize systemd unit file
- Call the nginx binary directly, no need to wrap the SysV init file. - Create /var/log/nginx with tmpfiles, like volatiles without systemd. - Run nginx with ${NGINX_USER} (user ${NGINX_USER} in nginx.conf) Signed-off-by: Gyorgy Szombathelyi <gyurco@freemail.hu> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-webserver')
-rw-r--r--meta-webserver/recipes-httpd/nginx/files/nginx.service9
-rw-r--r--meta-webserver/recipes-httpd/nginx/nginx.inc5
2 files changed, 8 insertions, 6 deletions
diff --git a/meta-webserver/recipes-httpd/nginx/files/nginx.service b/meta-webserver/recipes-httpd/nginx/files/nginx.service
index 9926a4b9d9..ce99061717 100644
--- a/meta-webserver/recipes-httpd/nginx/files/nginx.service
+++ b/meta-webserver/recipes-httpd/nginx/files/nginx.service
@@ -3,10 +3,9 @@ Description=Nginx Server
After=network.target
[Service]
Type=forking
-PIDFile=@SYSCONFDIR@/nginx/run/nginx.pid
-ExecStartPre=@BASEBINDIR@/mkdir -p @LOCALSTATEDIR@/log/nginx
-ExecStart=@SYSCONFDIR@/init.d/nginx start
-ExecStop=@SYSCONFDIR@/init.d/nginx stop
+PIDFile=/run/nginx/nginx.pid
+ExecStart=@SBINDIR@/nginx
+ExecStop=@SBINDIR@/nginx -s stop
+ExecReload=@SBINDIR@/nginx -s reload
[Install]
WantedBy=multi-user.target
-
diff --git a/meta-webserver/recipes-httpd/nginx/nginx.inc b/meta-webserver/recipes-httpd/nginx/nginx.inc
index fe51ca017f..b0d2d97286 100644
--- a/meta-webserver/recipes-httpd/nginx/nginx.inc
+++ b/meta-webserver/recipes-httpd/nginx/nginx.inc
@@ -75,6 +75,8 @@ do_install () {
install -d ${D}${sysconfdir}/tmpfiles.d
echo "d /run/${BPN} - - - -" \
> ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
+ echo "d /${localstatedir}/log/${BPN} 0755 root root -" \
+ >> ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
fi
install -d ${D}${sysconfdir}/${BPN}
ln -snf ${localstatedir}/run/${BPN} ${D}${sysconfdir}/${BPN}/run
@@ -90,6 +92,7 @@ do_install () {
install -d ${D}${sysconfdir}/nginx
install -m 0644 ${WORKDIR}/nginx.conf ${D}${sysconfdir}/nginx/nginx.conf
sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/nginx/nginx.conf
+ sed -i 's/^user.*/user ${NGINX_USER};/g' ${D}${sysconfdir}/nginx/nginx.conf
install -d ${D}${sysconfdir}/nginx/sites-enabled
install -d ${D}${sysconfdir}/default/volatiles
@@ -101,7 +104,7 @@ do_install () {
install -m 0644 ${WORKDIR}/nginx.service ${D}${systemd_unitdir}/system/
sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
-e 's,@LOCALSTATEDIR@,${localstatedir},g' \
- -e 's,@BASEBINDIR@,${base_bindir},g' \
+ -e 's,@SBINDIR@,${sbindir},g' \
${D}${systemd_unitdir}/system/nginx.service
fi
}