[Unit] Description=Rust Backend Service (Weather Data Collection API) After=network.target postgresql.service Wants=network.target [Service] Type=simple User=root Group=root WorkingDirectory=/root/rust/rust_backend ExecStart=/root/rust/rust_backend/rust-backend Restart=always RestartSec=5 StandardOutput=journal StandardError=journal # 环境变量配置 EnvironmentFile=/root/rust/rust_backend/.env # 安全加固 NoNewPrivileges=yes PrivateTmp=yes ProtectSystem=strict ProtectHome=read-only ReadWritePaths=/root/rust/rust_backend # 日志标识 SyslogIdentifier=rust-backend [Install] WantedBy=multi-user.target