[Unit] Description=A high performance web server and a reverse proxy server After=syslog.target network-online.target remote-fs.target nss-lookup.target Wants=network-online.target [Service] Type=forking PIDFile=/run/nginx.pid # jemalloc replaces glibc malloc — better fragmentation/perf under nginx's # alloc/free churn at scale. Package depends on libjemalloc2 so the .so is # guaranteed present. Removing this line falls back to glibc malloc cleanly. Environment=LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 ExecStartPre=/usr/bin/install -d -o nginx -g nginx -m 0755 /usr/local/nginx /usr/local/nginx/client_body_temp /usr/local/nginx/proxy_temp /usr/local/nginx/fastcgi_temp /usr/local/nginx/uwsgi_temp /usr/local/nginx/scgi_temp /var/log/nginx ExecStartPre=/usr/sbin/nginx -t ExecStart=/usr/sbin/nginx ExecReload=/usr/sbin/nginx -s reload ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target