Created
November 22, 2017 22:08
-
-
Save clemensg/7dd024169efe8ce6e7fa4a0b3caa3780 to your computer and use it in GitHub Desktop.
Example nginx service file for systemd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=NGINX HTTP and reverse proxy server | |
After=syslog.target network.target nss-lookup.target | |
[Service] | |
Type=forking | |
PIDFile=/var/run/nginx.pid | |
ExecStartPre=/usr/sbin/nginx -t | |
ExecStart=/usr/sbin/nginx | |
ExecReload=/usr/bin/kill -s HUP $MAINPID | |
ExecStop=/usr/bin/kill -s QUIT $MAINPID | |
# Hardening | |
InaccessiblePaths=/etc/gnupg /etc/shadow /etc/ssh | |
ProtectSystem=full | |
ProtectKernelTunables=yes | |
ProtectControlGroups=yes | |
SystemCallFilter=~@clock @cpu-emulation @debug @keyring @module @mount @obsolete @raw-io | |
MemoryDenyWriteExecute=yes | |
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX | |
RestrictRealtime=yes | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment