Skip to content

Instantly share code, notes, and snippets.

@spajak
Last active December 13, 2019 16:19
Show Gist options
  • Save spajak/3999d4a35ff611a6383f13b2dc988766 to your computer and use it in GitHub Desktop.
Save spajak/3999d4a35ff611a6383f13b2dc988766 to your computer and use it in GitHub Desktop.
Nginx, uWSGI and php-fpm, haraka systemd service units
[Unit]
Description=Haraka SMTP server
After=syslog.target network.target
[Service]
Type=simple
PIDFile=/var/run/haraka.pid
ExecStart=/usr/bin/haraka -c /usr/local/etc/haraka
ExecStop=/bin/kill -s QUIT $MAINPID
[Install]
WantedBy=multi-user.target
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStartPre=/usr/local/sbin/nginx -c /usr/local/etc/nginx/nginx.conf -t
ExecStart=/usr/local/sbin/nginx -c /usr/local/etc/nginx/nginx.conf
ExecReload=/usr/local/sbin/nginx -c /usr/local/etc/nginx/nginx.conf -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
[Install]
WantedBy=multi-user.target
[Unit]
Description=The PHP FastCGI Process Manager
After=network.target
[Service]
Type=notify
PIDFile=/run/php/php-fpm.pid
ExecStart=/usr/local/sbin/php-fpm --nodaemonize --fpm-config /usr/local/etc/php/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
[Install]
WantedBy=multi-user.target
[Unit]
Description=Redis Server
After=network.target
[Service]
Type=notify
ExecStart=/usr/local/bin/redis-server /usr/local/etc/redis/6379.conf --supervised systemd
User=redis
Group=redis
Restart=always
RestartSec=3s
ExecStop=/usr/local/bin/redis-cli shutdown
PIDFile=/run/redis/6379.pid
RuntimeDirectory=redis
ReadWriteDirectories=-/var/lib/redis
ReadWriteDirectories=-/var/log/redis
ReadWriteDirectories=-/var/run/redis
[Install]
WantedBy=multi-user.target
[Unit]
Description=uWSGI Emperor
After=syslog.target
[Service]
ExecStart=/usr/local/bin/uwsgi --ini /usr/local/etc/uwsgi/emperor.ini
RuntimeDirectory=uwsgi
RuntimeDirectoryMode=775
User=www-data
Group=www-data
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment