[Unit] Description=AAZ Accounting System (Gunicorn) After=network.target mysql.service Wants=mysql.service [Service] Type=notify User=aaz_accounting Group=www-data WorkingDirectory=/var/www/aaz_accounting Environment="PATH=/var/www/aaz_accounting/venv/bin" EnvironmentFile=/var/www/aaz_accounting/.env ExecStart=/var/www/aaz_accounting/venv/bin/gunicorn \ --workers 3 \ --worker-class sync \ --bind 127.0.0.1:8000 \ --timeout 120 \ --keep-alive 5 \ --max-requests 1000 \ --max-requests-jitter 100 \ --access-logfile /var/www/aaz_accounting/logs/gunicorn_access.log \ --error-logfile /var/www/aaz_accounting/logs/gunicorn_error.log \ --log-level info \ --capture-output \ "wsgi:app" ExecReload=/bin/kill -s HUP $MAINPID KillMode=mixed TimeoutStopSec=5 PrivateTmp=true NoNewPrivileges=true ProtectSystem=strict ProtectHome=true ReadWritePaths=/var/www/aaz_accounting/logs ReadWritePaths=/var/www/aaz_accounting/uploads_secure ReadWritePaths=/var/www/aaz_accounting/exports_secure RestartSec=5 Restart=on-failure [Install] WantedBy=multi-user.target