[{"data":1,"prerenderedAt":218},["ShallowReactive",2],{"seo-verification":3,"blog-how-to-host-posthog-on-a-vps-ma-en":6,"promo-bar-likely":217},{"google":4,"bing":5},"EycwPY2XMyTkVzas3n1ygeNJFGAH513qrMjfDljzsMQ","",{"key":7,"data":8},"blog-how-to-host-posthog-on-a-vps-ma-en",{"id":9,"slug":10,"slugs":11,"title":15,"excerpt":16,"readTime":17,"views":18,"isPinned":19,"noindex":19,"publishedAt":20,"updatedAt":21,"category":22,"categories":28,"featuredImage":30,"bgImage":31,"posterImage":32,"relatedSolution":33,"intro":36,"sections":37,"ctaTitle":156,"ctaBody":157,"ctaButton":158,"ctaUrl":159,"relatedPosts":160},155,"how-to-host-posthog-on-a-vps",{"fr":12,"en":10,"ar":13,"es":14},"heberger-posthog-vps","كيفية-استضافة-posthog-على-خادم-vps","como-alojar-posthog-en-un-vps","How to Host PostHog on a VPS","Host PostHog on a VPS: annotated Docker Compose, MinIO for session recordings, feature flags, JS SDK. Full self-hosted analytics guide.",9,2,false,"2026-01-22T00:00:00+00:00","2026-10-02T14:03:20+00:00",{"id":23,"name":24,"slug":25,"color":26,"icon":27},7,"Self-hosting","self-hosting","bg-indigo-500\u002F10 text-indigo-400","cloud",[29],{"id":23,"name":24,"slug":25,"color":26,"icon":27},null,"\u002Fblog\u002Fcovers\u002Fbg.svg","\u002Fblog\u002Fcovers\u002Fheberger-posthog-vps-poster.svg",{"categorySlug":34,"appSlug":35},"analytics","analytics-posthog","PostHog is the open-source answer to Mixpanel and Amplitude: events, funnels, session recordings, feature flags and A\u002FB testing in a single self-hosted instance. On the vendor's cloud, the bill rises as soon as your event volume exceeds the free tier — a few million events per month is enough to reach several hundred dollars. On your VPS, the cost is simply that of the server. You keep your users' behavioural data on your own infrastructure, you comply with GDPR without additional contracts, and you enable every module — session replay, feature flags, A\u002FB experiments — with no paid tier. This guide covers step-by-step installation via Docker Compose, configuring an nginx reverse proxy with HTTPS, setting up object storage for session recordings, wiring up the JavaScript SDK, and activating feature flags.",[38,42,76,79,98,113,128,143,146,150,153],{"type":39,"title":40,"body":41},"h2","What PostHog does that SaaS alternatives cannot","Mixpanel, Amplitude and Heap are cloud tools: your data goes to their servers, their retention policy dictates how long you can keep it, and sampling kicks in automatically once your volume exceeds certain thresholds. Self-hosted PostHog removes all three of those constraints. Events stay in your ClickHouse database, on your disk or your object storage — no copy leaves your infrastructure. retention has no imposed ceiling: you decide when to purge old data. There is no sampling: every event is recorded, even during traffic spikes. Add to that GDPR compliance without negotiating a DPA with a third party, the ability to modify the source code, and direct access to raw data in ClickHouse for your own SQL analyses.",{"type":43,"title":44,"headers":45,"rows":49},"comparison","Quick comparison: PostHog self-hosted vs Mixpanel Cloud",[46,47,48],"Criterion","PostHog self-hosted","Mixpanel Cloud",[50,54,58,62,66,69,73],[51,52,53],"Monthly cost (1M events\u002Fmonth)","~$15–20 (VPS cost)","~$25–100+",[55,56,57],"Data hosted on your servers","Yes","No",[59,60,61],"Simplified GDPR compliance","Yes (no third-party DPA)","Partial (DPA required)",[63,64,65],"Automatic sampling","None","Activated beyond tiers",[67,56,68],"Session recordings included","Paid option",[70,71,72],"Feature flags & A\u002FB testing","Yes, included","Paid (Growth+ plan)",[74,75,57],"Raw SQL access to data","Yes (direct ClickHouse)",{"type":39,"title":77,"body":78},"Server requirements","PostHog ships ClickHouse, Kafka, Redis and PostgreSQL in the same Docker Compose stack. It is the most resource-intensive analytics solution in this category, and under-sizing the VPS causes ClickHouse crashes or Kafka timeouts from the very first events. Plan for at least 4 vCPU and 8 GB of RAM for light usage (less than one million events per month). For a more sustained load — 1 to 5 million events per month — aim for 8 vCPU and 16 GB of RAM. On the storage side, ClickHouse is very efficient at compression, but session recordings accumulate quickly: allow at least 50 GB of SSD, and add external object storage (S3 or MinIO) as soon as you enable recordings. On the software side: Docker Engine 24+ and Docker Compose v2, a domain name with an A record pointing to the VPS, and ports 80 and 443 open in your firewall.",{"type":80,"title":81,"steps":82},"steps","Install PostHog with Docker Compose",[83,86,89,92,95],{"title":84,"body":85},"Install Docker on the VPS","Connect via SSH, then install Docker with the official script: `curl -fsSL https:\u002F\u002Fget.docker.com | sh`. Add your user to the docker group to avoid sudo: `usermod -aG docker $USER`. Verify with `docker compose version` that Compose v2 is available.",{"title":87,"body":88},"Clone the PostHog repository and prepare the environment","Clone the official repository: `git clone https:\u002F\u002Fgithub.com\u002FPostHog\u002Fposthog.git && cd posthog`. Copy the sample environment file: `cp .env.example .env`. Open `.env` in an editor to configure the essential variables.",{"title":90,"body":91},"Configure environment variables","In `.env`, set at a minimum: `SECRET_KEY` (generate a 50-character random key with `python3 -c \"import secrets; print(secrets.token_hex(25))\"`), `SITE_URL=https:\u002F\u002Fposthog.your-domain.com`, `DISABLE_SECURE_SSL=false` (or `true` if testing over HTTP locally without a certificate). Leave the `POSTGRES_*`, `REDIS_*` and `CLICKHOUSE_*` defaults for a simple deployment.",{"title":93,"body":94},"Start the stack and wait for the migration","Launch all services in the background: `docker compose -f docker-compose.yml up -d`. The first time, PostHog automatically runs database migrations — this takes 2 to 5 minutes depending on server performance. Follow progress with `docker compose logs -f web` until you see `PostHog server is now listening on port 8000`.",{"title":96,"body":97},"Access the interface and create your account","Navigate to `http:\u002F\u002Flocalhost:8000` (or via your domain if DNS is already configured). The first-launch wizard guides you through creating the admin account, naming your organisation, and creating your first project. Note the `Project API Key` shown — you will need it to wire up the SDK.",{"type":80,"title":99,"steps":100},"Configure an nginx reverse proxy for HTTPS",[101,104,107,110],{"title":102,"body":103},"Install nginx and Certbot","On the host machine (outside Docker): `apt install -y nginx certbot python3-certbot-nginx`. Make sure your domain `posthog.your-domain.com` already points to the VPS IP before this step — Certbot needs to validate via HTTP.",{"title":105,"body":106},"Create the nginx vhost","Create `\u002Fetc\u002Fnginx\u002Fsites-available\u002Fposthog` with: `server { listen 80; server_name posthog.your-domain.com; location \u002F { proxy_pass http:\u002F\u002F127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }`. Enable it: `ln -s \u002Fetc\u002Fnginx\u002Fsites-available\u002Fposthog \u002Fetc\u002Fnginx\u002Fsites-enabled\u002F`.",{"title":108,"body":109},"Issue the TLS certificate","Run `certbot --nginx -d posthog.your-domain.com`. Certbot automatically updates the vhost to redirect HTTP to HTTPS and configures automatic renewal. Test renewal with `certbot renew --dry-run`.",{"title":111,"body":112},"Reload nginx and verify","Apply the configuration: `nginx -t && systemctl reload nginx`. Open `https:\u002F\u002Fposthog.your-domain.com` in a browser — you should see the PostHog interface with a valid certificate. Update `SITE_URL` in `.env` if not already done, then restart the web service: `docker compose restart web`.",{"type":80,"title":114,"steps":115},"Object storage for session recordings (S3 or MinIO)",[116,119,122,125],{"title":117,"body":118},"Why object storage is necessary","Session recordings generate many small files (one per session segment). Storing them on the VPS local disk fills the SSD quickly and complicates backups. An S3-compatible object storage — whether AWS S3, Cloudflare R2 or self-hosted MinIO — externalises this storage elastically.",{"title":120,"body":121},"Deploy MinIO on the same VPS (self-hosted option)","If you do not want to depend on an external service, add MinIO to your `docker-compose.yml`: `minio: image: minio\u002Fminio environment: MINIO_ROOT_USER: posthog MINIO_ROOT_PASSWORD: change-me-strong-password command: server \u002Fdata --console-address ':9001' volumes: - .\u002Fminio-data:\u002Fdata`. Then create a bucket named `posthog` in the MinIO console (port 9001).",{"title":123,"body":124},"Configure PostHog environment variables","In `.env`, add: `OBJECT_STORAGE_ENABLED=true`, `OBJECT_STORAGE_ENDPOINT=http:\u002F\u002Fminio:9000` (or your S3 bucket URL), `OBJECT_STORAGE_ACCESS_KEY_ID=posthog`, `OBJECT_STORAGE_SECRET_ACCESS_KEY=change-me-strong-password`, `OBJECT_STORAGE_BUCKET=posthog`. Restart the stack: `docker compose up -d`.",{"title":126,"body":127},"Verify with a first session recording","In PostHog project settings, enable 'Session recording'. Browse your application for a few seconds, then return to PostHog under 'Session Recordings'. A recording should appear within a few minutes. Check in MinIO (or S3) that files have been created in the bucket.",{"type":80,"title":129,"steps":130},"Send your first events from your application",[131,134,137,140],{"title":132,"body":133},"Install the JavaScript SDK","In your front-end project: `npm install posthog-js`. If you use a framework such as React, Vue or Next.js, import and initialise PostHog once at the root level of your application.",{"title":135,"body":136},"Initialise with your project key and your instance URL","Add the initialisation: `import posthog from 'posthog-js'; posthog.init('phc_YOUR_PROJECT_API_KEY', { api_host: 'https:\u002F\u002Fposthog.your-domain.com', autocapture: true });`. Replace `phc_YOUR_PROJECT_API_KEY` with the key visible in PostHog project settings. With `autocapture: true`, PostHog automatically records clicks, form submissions and page changes.",{"title":138,"body":139},"Capture custom events","For a specific business event, call: `posthog.capture('order_placed', { amount: 49.90, currency: 'USD', product: 'vps-cloud-4vcpu' });`. The properties associated with the event will be available in funnels, cohorts and ClickHouse SQL queries.",{"title":141,"body":142},"Verify in the dashboard","Go to PostHog under 'Activity' or 'Events'. Events appear in near-real-time (a few seconds of latency). If nothing arrives after two minutes, check that `api_host` in the init exactly matches your instance URL, and that the TLS certificate is valid.",{"type":39,"title":144,"body":145},"Enable Feature Flags","Feature flags let you roll out a feature progressively — first to 5% of users, then 20%, then 100% — without recompiling or redeploying your application. In PostHog, go to 'Feature Flags' and create a new flag with a key (`my-new-module`), a rollout condition (percentage or user cohort), and optionally variants for a proper A\u002FB test. On the JavaScript side, evaluate the flag: `if (posthog.isFeatureEnabled('my-new-module')) { \u002F* show the new feature *\u002F }`. For server-side evaluation (Python or Node.js), use the corresponding backend SDK with the same `PROJECT_API_KEY` — evaluation then happens without a client round-trip, avoiding content flash. PostHog automatically records a `$feature_flag_called` event on every evaluation, letting you correlate a flag activation with any metric in your dashboard.",{"type":147,"title":148,"body":149},"tip","Performance tip: disable session recordings at launch","If your VPS is configured with the minimum 4 vCPU \u002F 8 GB of RAM, session recordings consume significant ClickHouse resources from the very first hours of traffic. Recommendation: leave recordings disabled for the first 30 days. This gives you time to validate stack stability, fine-tune the object storage configuration, and add RAM if needed. Enable them afterwards in project settings — all future recordings will be captured, and you can set a sampling rate to record only a percentage of sessions and keep storage under control.",{"type":39,"title":151,"body":152},"Updating PostHog","The PostHog team releases regular updates. To update: `git pull origin master` in the repository directory, then `docker compose pull` to fetch the new images, then `docker compose up -d`. Database migrations run automatically when the web service restarts — a brief interruption of a few tens of seconds is normal. Check the release notes before each major update: some versions require an intermediate update (no version skipping).",{"type":147,"title":154,"body":155},"Official documentation","This guide covers the basic VPS installation. For advanced topics — ClickHouse replication, SAML SSO, webhooks, data warehouse integrations, and Kafka configuration options — refer to the \u003Ca href=\"https:\u002F\u002Fposthog.com\u002Fdocs\u002Fself-host\" target=\"_blank\" rel=\"noopener noreferrer\">official PostHog documentation\u003C\u002Fa>. It remains the reference for major updates and specific use cases.","Deploy your instance on a ServOrbit Cloud VPS","A ServOrbit Cloud VPS with Docker preconfigured and scalable resources lets you install this tool without friction, and adjust RAM and vCPU as usage grows.","Launch my Cloud VPS","\u002Fvps-cloud",[161,179,195],{"id":162,"slug":163,"slugs":164,"title":168,"excerpt":169,"readTime":18,"views":170,"isPinned":19,"noindex":19,"publishedAt":171,"updatedAt":172,"category":173,"categories":174,"featuredImage":30,"bgImage":31,"posterImage":176,"relatedSolution":177},154,"how-to-host-matomo-on-a-vps",{"fr":165,"en":163,"ar":166,"es":167},"heberger-matomo-vps","كيفية-استضافة-matomo-على-خادم-vps","como-alojar-matomo-en-un-vps","How to Host Matomo on a VPS","Deploy Matomo on your VPS: a complete alternative to Google Analytics, with 100% ownership of your data, self-hosted with Docker and HTTPS. Step-by-step guide.",1,"2026-01-23T00:00:00+00:00","2026-09-07T11:26:10+00:00",{"id":23,"name":24,"slug":25,"color":26,"icon":27},[175],{"id":23,"name":24,"slug":25,"color":26,"icon":27},"\u002Fblog\u002Fcovers\u002Fheberger-matomo-vps-poster.svg",{"categorySlug":34,"appSlug":178},"analytics-matomo",{"id":180,"slug":181,"slugs":182,"title":186,"excerpt":187,"readTime":18,"views":170,"isPinned":19,"noindex":19,"publishedAt":188,"updatedAt":172,"category":189,"categories":190,"featuredImage":30,"bgImage":31,"posterImage":192,"relatedSolution":193},153,"how-to-host-plausible-analytics-on-a-vps",{"fr":183,"en":181,"ar":184,"es":185},"heberger-plausible-vps","كيفية-استضافة-plausible-analytics-على-خادم-vps","como-alojar-plausible-analytics-en-un-vps","How to Host Plausible Analytics on a VPS","Deploy Plausible Analytics on your VPS: lightweight, cookie-free and GDPR-compliant analytics, self-hosted with Docker, ClickHouse and HTTPS. Step-by-step guide.","2026-01-24T00:00:00+00:00",{"id":23,"name":24,"slug":25,"color":26,"icon":27},[191],{"id":23,"name":24,"slug":25,"color":26,"icon":27},"\u002Fblog\u002Fcovers\u002Fheberger-plausible-vps-poster.svg",{"categorySlug":34,"appSlug":194},"analytics-plausible",{"id":196,"slug":197,"slugs":198,"title":202,"excerpt":203,"readTime":196,"views":170,"isPinned":19,"noindex":19,"publishedAt":204,"updatedAt":205,"category":206,"categories":211,"featuredImage":30,"bgImage":31,"posterImage":213,"relatedSolution":214},8,"how-to-host-flowise-on-a-vps",{"fr":199,"en":197,"ar":200,"es":201},"heberger-flowise-vps","كيفية-استضافة-flowise-على-خادم-vps","como-alojar-flowise-en-un-vps","How to Host Flowise on a VPS","Deploy Flowise on your VPS: build no-code AI agents and chatbots with Docker and SSL. Environment variables, RAG with Ollama, updates and troubleshooting.","2026-06-12T00:00:00+00:00","2026-09-19T02:00:43+00:00",{"id":170,"name":207,"slug":208,"color":209,"icon":210},"Artificial Intelligence","intelligence-artificielle","bg-purple-500\u002F10 text-purple-400","ia",[212],{"id":170,"name":207,"slug":208,"color":209,"icon":210},"\u002Fblog\u002Fcovers\u002Fheberger-flowise-vps-poster.svg",{"categorySlug":215,"appSlug":216},"artificial-intelligence","flowise",true,1794270427874]