How to create a systemd service for your app
Updated 11/29/2026
A systemd service keeps your app running, restarts it if it stops and launches it automatically at boot. It is the correct way to run production processes on Linux.
1. Create the service file
Create /etc/systemd/system/my-app.service:
[Unit]
Description=My app
After=network.target
[Service]
User=www-data
WorkingDirectory=/var/www/app
ExecStart=/usr/bin/node server.js
Restart=always
Environment="NODE_ENV=production"
[Install]
WantedBy=multi-user.target
2. Start and enable
systemctl daemon-reload
systemctl enable --now my-app
3. Check the status
systemctl status my-app
journalctl -u my-app -f
See the service logs, useful for debugging, see managing logs.
Advantages over running manually
- Starts automatically after a server reboot.
- Restarts itself if the app crashes (
Restart=always). - Centralized logs through journalctl.
It works for Node, Python, Go apps or any process that must run continuously.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
Error tracking for your applications with GlitchTip
Catch production exceptions with the Sentry SDKs on a small server: the project, the DSN, alerts and uptime.
Updated 11/29/2026Dev environmentsTest your application's email with smtp4dev
Send the email from Laravel, WordPress, Node or Python to a test SMTP server and read it in a web inbox, without it ever reaching real customers.
Updated 11/29/2026Dev environmentsHow to set up a staging environment
Test changes on a copy of production before shipping them, to avoid surprises.
Updated 11/29/2026