This is the second revision of the systemd service file for NGINX.
This commit removes redundant Exec{Stop,Reload} lines that restate
the
systemd defaults and changes the ExecStartPre directive from "nginx -
t"
(testing the NGINX configuration that is done anyway by the main
process, bug 481456) to "mkdir -p /var/tmp/nginx", making sure the
required directory for the NGINX temp files is present. ExecStopPost
has
also been removed, since sleeping for 100 ms serves no purpose.
The second revision also changes the Exec* directives to use the
plain
file names, instead of the absolute ones, per systemd.service(5)
guidelines:
It is thus safe to use just the executable name in case of
executables
located in any of the "standard" directories, and an absolute path
must be used in other cases.
Bug: https://bugs.gentoo.org/481456
Signed-off-by: Zurab Kvachadze <zurabid2016@gmail.com>
---
www-servers/nginx/files/nginx-r2.service | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 www-servers/nginx/files/nginx-r2.service
diff --git a/www-servers/nginx/files/nginx-r2.service b/www- servers/nginx/files/nginx-r2.service
new file mode 100644
index 000000000000..2916aba391a2
--- /dev/null
+++ b/www-servers/nginx/files/nginx-r2.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=The NGINX HTTP and reverse proxy server
+After=network.target remote-fs.target nss-lookup.target
+
+[Service]
+Type=forking
+PIDFile=/run/nginx.pid
+ExecStartPre=mkdir -p /var/tmp/nginx
+ExecStart=nginx
+
+[Install]
+WantedBy=multi-user.target
But so long as we're talking about it: what do the file names under /var/tmp/nginx look like? Hopefully they're random. Otherwise we have
to worry about the bad guy pre-creating not only the directory, but
also the files inside it.
В Сб, 20/07/2024 в 13:15 -0400, Michael Orlitzky пишет:
But so long as we're talking about it: what do the file names under /var/tmp/nginx look like? Hopefully they're random. Otherwise we
have
to worry about the bad guy pre-creating not only the directory, but
also the files inside it.
No, their names are predefined. For example with the current in-tree
nginx:
$ sudo ls -1 /var/lib/nginx/tmp/
client
fastcgi
proxy
scgi
uwsgi
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 475 |
Nodes: | 16 (2 / 14) |
Uptime: | 17:55:31 |
Calls: | 9,487 |
Calls today: | 6 |
Files: | 13,617 |
Messages: | 6,121,091 |