Deployment
Systemd Service
Create /etc/systemd/system/nginjen.service:
ini
[Unit]
Description=Nginjen Browser Automation Engine
After=network.target
[Service]
Type=simple
User=nginjen
ExecStart=/usr/local/bin/nginjen serve --config /etc/nginjen/config.toml
Restart=on-failure
RestartSec=5
Environment=RUST_LOG=info
# Security hardening
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
ReadWritePaths=/var/lib/nginjen
[Install]
WantedBy=multi-user.targetbash
# Create user and data dir
sudo useradd -r -s /bin/false nginjen
sudo mkdir -p /var/lib/nginjen /etc/nginjen
sudo cp config.example.toml /etc/nginjen/config.toml
# Install and start
sudo systemctl daemon-reload
sudo systemctl enable nginjen
sudo systemctl start nginjen
# Check status
sudo systemctl status nginjenReverse Proxy (Nginx)
nginx
server {
listen 443 ssl http2;
server_name nginjen.example.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://127.0.0.1:9090;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# WebSocket support
location /ws {
proxy_pass http://127.0.0.1:9090;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}Docker
dockerfile
FROM rust:1.85 AS builder
WORKDIR /app
COPY . .
RUN cargo build --release
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
ca-certificates \
fonts-liberation \
libnss3 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libxkbcommon0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libpango-1.0-0 \
libcairo2 \
libasound2 \
xvfb \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/nginjen /usr/local/bin/
EXPOSE 9090
VOLUME ["/data"]
CMD ["nginjen", "serve", "--config", "/data/config.toml"]bash
docker build -t nginjen .
docker run -d \
--name nginjen \
-p 9090:9090 \
-v $(pwd)/config.toml:/data/config.toml \
nginjenXvfb for Virtual Display Mode
For maximum stealth (headless_mode = "virtual-display"), install Xvfb:
bash
# Debian/Ubuntu
sudo apt install xvfb
# Verify
nginjen doctorThe doctor check will confirm virtual display availability.
Health Monitoring
bash
# Simple health check
curl http://127.0.0.1:9090/health
# Full diagnostics
nginjen doctorFor production monitoring, set up a cron job or health check endpoint in your load balancer pointing to /health.