<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux VPS &#8211; Aveshost Blog</title>
	<atom:link href="https://blog.aveshost.com/tag/linux-vps/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.aveshost.com</link>
	<description>Your Blueprint for Online Success</description>
	<lastBuildDate>Thu, 19 Nov 2026 18:40:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>

<image>
	<url>https://blog.aveshost.com/wp-content/uploads/2026/01/logo-150x150.png</url>
	<title>Linux VPS &#8211; Aveshost Blog</title>
	<link>https://blog.aveshost.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Deploy FastAPI on an Ubuntu VPS with Nginx and HTTPS</title>
		<link>https://blog.aveshost.com/deploy-fastapi-ubuntu-vps/</link>
					<comments>https://blog.aveshost.com/deploy-fastapi-ubuntu-vps/#respond</comments>
		
		<dc:creator><![CDATA[James Wilson]]></dc:creator>
		<pubDate>Thu, 19 Nov 2026 18:40:00 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Hosting]]></category>
		<category><![CDATA[FastAPI]]></category>
		<category><![CDATA[HTTPS]]></category>
		<category><![CDATA[Linux VPS]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://blog.aveshost.com/?p=6020</guid>

					<description><![CDATA[Run FastAPI privately behind Nginx, keep it online with systemd, enable HTTPS with Certbot and verify the deployment from application to certificate renewal.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">To <strong>deploy FastAPI</strong> on an Ubuntu VPS, run the application with Uvicorn on <code>127.0.0.1:8000</code>, supervise it with systemd, and put Nginx in front on ports 80 and 443. Nginx terminates HTTPS while the application remains reachable only through the local upstream.</p>



<p class="wp-block-paragraph">Our walkthrough takes a small API from a Python virtual environment to a working domain with a renewable certificate. It uses a dedicated service account and includes checks at each layer, so you can identify a failed application, proxy configuration or certificate challenge separately.</p>



<p class="wp-block-paragraph">Use a fresh Ubuntu 24.04 LTS VPS, SSH access with sudo privileges, and a domain or subdomain you control. Replace <code>api.example.com</code> throughout with your real hostname. This example serves a standard HTTP API at the domain root; it does not configure Docker, WebSockets, streaming, a database or a control-panel-managed Nginx installation.</p>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><div><div><a href="#prepare">1. Prepare the VPS, DNS and firewall</a></div><div><a href="#app">2. Create the application and virtual environment</a></div><div><a href="#systemd">3. Keep FastAPI running with systemd</a></div><div><a href="#nginx">4. Put Nginx in front of FastAPI</a></div><div><a href="#https">5. Enable HTTPS with Certbot</a></div><div><a href="#renewal">6. Verify renewal and external access</a></div><div><a href="#troubleshoot">7. Troubleshoot the failing layer</a></div><div><a href="#maintain">8. Deploy FastAPI updates and plan capacity</a></div><div><a href="#faq">Frequently asked questions</a></div></div></nav></div>



<h2 id="prepare" class="wp-block-heading">1. Prepare the VPS, DNS and firewall</h2>



<p class="wp-block-paragraph">Point the hostname’s A record to the VPS IPv4 address. Add an AAAA record only when IPv6 reaches this same server correctly. Keep an existing SSH connection open and confirm console recovery access before changing firewall policy.</p>



<p class="wp-block-paragraph">Install the packages used below:</p>



<pre class="wp-block-code"><code>sudo apt update
sudo apt install -y python3-venv nginx curl dnsutils ufw snapd
dig +short A api.example.com
dig +short AAAA api.example.com</code></pre>



<p class="wp-block-paragraph">For a new server using SSH on port 22, allow SSH and the web-server ports before enabling UFW:</p>



<pre class="wp-block-code"><code>sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable
sudo ufw status verbose</code></pre>



<p class="wp-block-paragraph">If SSH uses another port, allow that actual TCP port first. Preserve existing rules on a server already in use. Apply equivalent access rules to any upstream VPS firewall. Do not open port 8000 publicly. Ubuntu’s <a href="https://ubuntu.com/server/docs/how-to/security/firewalls/" rel="noopener">firewall guide</a> explains UFW, and its <a href="https://ubuntu.com/server/docs/how-to/web-services/install-nginx/" rel="noopener">Nginx guide</a> covers the Ubuntu package layout.</p>



<p class="wp-block-paragraph">For this HTTP-01 certificate workflow, the hostname must be publicly reachable on port 80. Incorrect DNS, including a stale AAAA record, can prevent validation. See <a href="https://letsencrypt.org/docs/challenge-types/" rel="noopener">Let’s Encrypt’s challenge requirements</a>.</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="1536" height="1024" src="https://blog.aveshost.com/wp-content/uploads/2026/11/fastapi-nginx-https-architecture.webp" alt="FastAPI deployment architecture showing Nginx handling HTTPS, localhost Uvicorn, systemd supervision and Certbot renewal." class="wp-image-6022" srcset="https://blog.aveshost.com/wp-content/uploads/2026/11/fastapi-nginx-https-architecture.webp 1536w, https://blog.aveshost.com/wp-content/uploads/2026/11/fastapi-nginx-https-architecture-300x200.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/11/fastapi-nginx-https-architecture-1024x683.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/11/fastapi-nginx-https-architecture-768x512.webp 768w" sizes="(max-width: 1536px) 100vw, 1536px" /></figure>



<h2 id="app" class="wp-block-heading">2. Create the application and virtual environment</h2>



<p class="wp-block-paragraph">Create a dedicated system account and project directory. These commands are for a new installation; choose different names if they already exist:</p>



<pre class="wp-block-code"><code>sudo adduser --system --group --home /opt/fastapi fastapi
sudo install -d -o fastapi -g fastapi -m 0755 /opt/fastapi
sudo -u fastapi python3 -m venv /opt/fastapi/.venv
sudo -u fastapi /opt/fastapi/.venv/bin/python -m pip install fastapi uvicorn</code></pre>



<p class="wp-block-paragraph">The <a href="https://docs.python.org/3/library/venv.html" rel="noopener">Python virtual environment</a> keeps application packages separate from Ubuntu’s system Python. For an existing project, install its reviewed, pinned requirements instead of replacing them with this demonstration’s dependencies.</p>



<p class="wp-block-paragraph">Create <code>/opt/fastapi/main.py</code> with <code>sudo nano /opt/fastapi/main.py</code>, paste the following and save:</p>



<pre class="wp-block-code"><code>from fastapi import FastAPI

app = FastAPI()

@app.get("/")
async def root():
    return {"message": "FastAPI is running"}

@app.get("/health")
async def health():
    return {"status": "ok"}
</code></pre>



<p class="wp-block-paragraph">Run the ASGI server in the foreground:</p>



<pre class="wp-block-code"><code>sudo -u fastapi /opt/fastapi/.venv/bin/uvicorn main:app --app-dir /opt/fastapi --host 127.0.0.1 --port 8000</code></pre>



<p class="wp-block-paragraph">In a second SSH session, run <code>curl -fsS http://127.0.0.1:8000/health</code>. Expect <code>{"status":"ok"}</code>. Stop the foreground server with Ctrl+C before starting systemd, freeing port 8000. FastAPI’s <a href="https://fastapi.tiangolo.com/deployment/manually/" rel="noopener">server documentation</a> explains the application import string.</p>



<h2 id="systemd" class="wp-block-heading">3. Keep FastAPI running with systemd</h2>



<p class="wp-block-paragraph">Create an empty environment file for application settings, readable by root and the service group:</p>



<pre class="wp-block-code"><code>sudo install -o root -g fastapi -m 0640 /dev/null /etc/fastapi.env</code></pre>



<p class="wp-block-paragraph">Later, add required <code>NAME=value</code> settings using <code>sudoedit /etc/fastapi.env</code>. The app must explicitly read those settings; creating the file does not configure a database automatically. Keep credentials out of source control and logs.</p>



<p class="wp-block-paragraph">Create <code>/etc/systemd/system/fastapi.service</code> with <code>sudo nano /etc/systemd/system/fastapi.service</code> and save:</p>



<pre class="wp-block-code"><code>&#91;Unit]
Description=FastAPI application
After=network.target

&#91;Service]
User=fastapi
Group=fastapi
WorkingDirectory=/opt/fastapi
EnvironmentFile=/etc/fastapi.env
ExecStart=/opt/fastapi/.venv/bin/uvicorn main:app --host 127.0.0.1 --port 8000 --workers 1 --proxy-headers --forwarded-allow-ips=127.0.0.1
Restart=on-failure
RestartSec=5
NoNewPrivileges=true
PrivateTmp=true

&#91;Install]
WantedBy=multi-user.target
</code></pre>



<p class="wp-block-paragraph">The absolute executable path removes the need to activate the virtual environment. <code>WorkingDirectory</code> lets Uvicorn import <code>main:app</code>. The service runs as the dedicated account and restarts after failure; repeated failures can still hit systemd’s start-rate limits.</p>



<pre class="wp-block-code"><code>sudo systemctl daemon-reload
sudo systemctl enable --now fastapi
sudo systemctl status fastapi --no-pager
curl -fsS http://127.0.0.1:8000/health</code></pre>



<p class="wp-block-paragraph">If it fails, inspect <code>sudo journalctl -u fastapi -n 100 --no-pager</code>. See the <a href="https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html" rel="noopener">systemd service reference</a> for supervision and the <a href="https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html" rel="noopener">execution reference</a> for users, directories and environment files.</p>



<h2 id="nginx" class="wp-block-heading">4. Put Nginx in front of FastAPI</h2>



<p class="wp-block-paragraph">Create <code>/etc/nginx/sites-available/fastapi</code> with <code>sudo nano /etc/nginx/sites-available/fastapi</code>. Use this HTTP configuration first:</p>



<pre class="wp-block-code"><code>server {
    listen 80;
    listen &#91;::]:80;
    server_name api.example.com;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
</code></pre>



<p class="wp-block-paragraph">Enable the site, test syntax, then start or reload Nginx:</p>



<pre class="wp-block-code"><code>sudo ln -s /etc/nginx/sites-available/fastapi /etc/nginx/sites-enabled/fastapi
sudo nginx -t
sudo systemctl enable --now nginx
sudo systemctl reload nginx
curl -fsS http://api.example.com/health</code></pre>



<p class="wp-block-paragraph">Create the symlink only once. On a server hosting other sites, preserve their files and avoid duplicate <code>server_name</code> entries. If IPv6 is disabled at the OS level, omit the IPv6 listen directive rather than publishing a broken AAAA record.</p>



<p class="wp-block-paragraph">The <a href="https://nginx.org/en/docs/http/ngx_http_proxy_module.html" rel="noopener">Nginx proxy module</a> forwards requests to Uvicorn. This single-edge-proxy example overwrites incoming forwarded headers with values from Nginx’s connection; a CDN or additional load balancer requires a separate trusted-proxy design.</p>



<p class="wp-block-paragraph">Uvicorn trusts proxy headers only from <code>127.0.0.1</code> in our service command. Once HTTPS is enabled, that lets FastAPI build correct HTTPS redirects. Avoid trusting every source with a wildcard. FastAPI’s <a href="https://fastapi.tiangolo.com/advanced/behind-a-proxy/" rel="noopener">proxy guide</a> explains the trust boundary.</p>



<h2 id="https" class="wp-block-heading">5. Enable HTTPS with Certbot</h2>



<p class="wp-block-paragraph">Confirm the public HTTP hostname returns the health response before requesting a certificate. The endpoint is a harmless demonstration; do not send credentials or sensitive data over HTTP.</p>



<p class="wp-block-paragraph">This fresh-server workflow uses Certbot’s snap installation. If Certbot already exists through apt or another method, follow its migration instructions instead of mixing installations. Install the snap, then use its explicit executable path:</p>



<pre class="wp-block-code"><code>sudo snap install --classic certbot
sudo /snap/bin/certbot --nginx --redirect -d api.example.com</code></pre>



<p class="wp-block-paragraph">Follow the prompts for an account email and the certificate authority’s terms. Certbot’s Nginx plugin obtains the certificate and updates the selected site to serve HTTPS and redirect HTTP. Back up an existing Nginx configuration before letting it edit that configuration.</p>



<p class="wp-block-paragraph">Check the result without bypassing certificate verification:</p>



<pre class="wp-block-code"><code>sudo nginx -t
curl -fsS https://api.example.com/health
curl -fsS https://api.example.com/openapi.json</code></pre>



<p class="wp-block-paragraph">Visit <code>https://api.example.com/docs</code> and confirm the API documentation loads. HTTPS encrypts transport; it does not authenticate your API’s users. Add the access controls your real endpoints need. The <a href="https://certbot.eff.org/instructions?ws=nginx&amp;os=snap&amp;tab=standard" rel="noopener">official Certbot instructions</a> cover installation and issuance.</p>



<h2 id="renewal" class="wp-block-heading">6. Verify renewal and external access</h2>



<p class="wp-block-paragraph">Test automatic renewal and inspect the scheduled jobs:</p>



<pre class="wp-block-code"><code>sudo /snap/bin/certbot renew --dry-run
systemctl list-timers --all
sudo ss -ltnp</code></pre>



<p class="wp-block-paragraph">Confirm the Certbot renewal timer is present and scheduled. A successful initial certificate does not prove future renewal will work. Keep the required challenge route reachable and monitor expiry independently.</p>



<p class="wp-block-paragraph">In the listening-socket output, Uvicorn should use <code>127.0.0.1:8000</code>; Nginx should own the public web listeners. From a workstation outside the VPS, check HTTPS by hostname and verify that port 8000 is unreachable. Test IPv6 separately if the hostname has an AAAA record.</p>



<p class="wp-block-paragraph">Make a normal API request after a planned reboot and confirm <code>systemctl is-active fastapi nginx</code> reports both services active. The demo health route checks only the process’s HTTP response. For a database-backed app, design readiness checks that also validate critical dependencies without exposing secrets.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1536" height="1024" src="https://blog.aveshost.com/wp-content/uploads/2026/11/fastapi-deployment-checks.webp" alt="Four FastAPI deployment checks covering application health, systemd, Nginx configuration and HTTPS certificate renewal." class="wp-image-6023" srcset="https://blog.aveshost.com/wp-content/uploads/2026/11/fastapi-deployment-checks.webp 1536w, https://blog.aveshost.com/wp-content/uploads/2026/11/fastapi-deployment-checks-300x200.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/11/fastapi-deployment-checks-1024x683.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/11/fastapi-deployment-checks-768x512.webp 768w" sizes="(max-width: 1536px) 100vw, 1536px" /></figure>



<h2 id="troubleshoot" class="wp-block-heading">7. Troubleshoot the failing layer</h2>



<p class="wp-block-paragraph">Diagnose from the application outward. If localhost is failing, changing DNS or requesting another certificate will not repair the Python process.</p>



<p class="wp-block-paragraph">Useful logs are <code>sudo journalctl -u fastapi -n 100 --no-pager</code> and <code>sudo tail -n 100 /var/log/nginx/error.log</code>. Redact tokens, cookies and personal data before sharing them. Avoid repeatedly retrying certificate issuance while DNS or network access is still broken.</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Symptom</th><th>Check first</th><th>Likely action</th></tr></thead><tbody><tr><td>502 Bad Gateway</td><td>Local health URL and service logs</td><td>Fix import, dependency, process or upstream port</td></tr><tr><td>Nginx welcome page</td><td>DNS and enabled server_name</td><td>Route the hostname to the intended site</td></tr><tr><td>Redirect uses HTTP</td><td>Forwarded scheme and trusted proxy IP</td><td>Keep Nginx headers and Uvicorn trust aligned</td></tr><tr><td>Certificate validation fails</td><td>Public DNS, port 80 and AAAA record</td><td>Correct the challenge path and network reachability</td></tr><tr><td>413 or streaming/WebSocket issues</td><td>Nginx body limits, buffering and upgrade settings</td><td>Configure the application-specific proxy behavior</td></tr></tbody></table></figure>



<h2 id="maintain" class="wp-block-heading">8. Deploy FastAPI updates and plan capacity</h2>



<p class="wp-block-paragraph">For application updates, retain a known working release and dependency set, run your tests, deploy the reviewed code, and restart <code>sudo systemctl restart fastapi</code>. Recheck local and public health endpoints. Run <code>daemon-reload</code> before restarting if the unit file changes. A restart can briefly interrupt requests; this single-server setup does not provide zero-downtime releases.</p>



<p class="wp-block-paragraph">Start with the one worker shown. Increase workers only after measuring CPU, memory and database-connection usage. Each process has its own memory and application state; background tasks or startup jobs may run in each worker. Use shared persistent storage and appropriate job coordination. See <a href="https://fastapi.tiangolo.com/deployment/server-workers/" rel="noopener">FastAPI’s worker guidance</a>.</p>



<p class="wp-block-paragraph">Protect production documentation and administrative endpoints as appropriate, back up persistent data off-server, monitor errors and disk growth, and keep Ubuntu and dependencies maintained. The empty environment-file creation command is a first-install step; do not rerun it over a populated settings file.</p>



<p class="wp-block-paragraph">Our <a href="https://www.aveshost.com/self-managed-vps-hosting" rel="noopener">self-managed VPS hosting</a> suits teams that want control of this stack. Size the server for your actual workload and management needs; <a href="https://www.aveshost.com/support" rel="noopener">contact our support team</a> to discuss the deployment. Our <a href="https://blog.aveshost.com/docker-disk-space-full/">VPS storage troubleshooting guide</a> is useful when logs or deployment artifacts fill a server.</p>



<h2 id="faq" class="wp-block-heading">Frequently asked questions</h2>


<div id="rank-math-faq" class="rank-math-block">
<div class="rank-math-list ">
<div id="faq-question-60f4db7d85054bdcba3bc74e43dfab88" class="rank-math-list-item">
<h3 class="rank-math-question ">Do I need Gunicorn to deploy FastAPI on a VPS?</h3>
<div class="rank-math-answer ">

<p>No. This setup uses Uvicorn directly under systemd. Uvicorn can run worker processes itself; choose a process model based on measured load and memory rather than adding a second manager automatically.</p>

</div>
</div>
<div id="faq-question-367e44d8e9f34581b2fec6553a27e78c" class="rank-math-list-item">
<h3 class="rank-math-question ">Should I run Uvicorn with &#8211;reload in production?</h3>
<div class="rank-math-answer ">

<p>No. Reload mode is intended for development. Deploy a reviewed release and restart the supervised service deliberately. Keep the application bound to localhost behind Nginx.</p>

</div>
</div>
<div id="faq-question-da375db5144f418ebdc4a51cc8e22f9b" class="rank-math-list-item">
<h3 class="rank-math-question ">Why does FastAPI work on localhost but return 502 through Nginx?</h3>
<div class="rank-math-answer ">

<p>Compare proxy_pass with the actual listening address and port, then inspect Nginx’s error log. Verify the enabled site configuration and whether the app is still running when the proxy request arrives.</p>

</div>
</div>
<div id="faq-question-2611c4d5ca7245adbf70539d9caa94c1" class="rank-math-list-item">
<h3 class="rank-math-question ">Does my API need its own certificate inside Uvicorn?</h3>
<div class="rank-math-answer ">

<p>Not in this same-host design. Nginx handles public HTTPS and forwards HTTP over loopback. If the upstream moves to another server or network, reassess encryption and trust for that connection.</p>

</div>
</div>
<div id="faq-question-afe3015930f04fd191e483a589b6f5b0" class="rank-math-list-item">
<h3 class="rank-math-question ">Can I deploy an existing database-backed FastAPI project this way?</h3>
<div class="rank-math-answer ">

<p>Yes, but add its pinned dependencies, environment settings, database connectivity, migrations, backups and readiness checks. Preserve persistent data outside disposable releases and plan rollback around schema compatibility.</p>

</div>
</div>
</div>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://blog.aveshost.com/deploy-fastapi-ubuntu-vps/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Docker and UFW: How to Stop Containers Exposing Unexpected Ports</title>
		<link>https://blog.aveshost.com/docker-ufw-unexpected-ports/</link>
					<comments>https://blog.aveshost.com/docker-ufw-unexpected-ports/#respond</comments>
		
		<dc:creator><![CDATA[James Wilson]]></dc:creator>
		<pubDate>Thu, 19 Nov 2026 17:44:55 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[Linux VPS]]></category>
		<category><![CDATA[UFW]]></category>
		<guid isPermaLink="false">https://blog.aveshost.com/?p=6013</guid>

					<description><![CDATA[Learn why Docker-published ports can bypass UFW and how to reduce exposure with private networks, loopback bindings, backend-aware rules and external testing.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph"><strong>Docker and UFW</strong> need separate attention on a Linux VPS. A container published with <code>8080:80</code> can remain reachable even when UFW denies incoming port 8080. The most reliable first fix is to remove unnecessary host port mappings, bind host-only services to loopback, and filter any deliberately public Docker traffic at the correct layer.</p>



<p class="wp-block-paragraph">Our recommended workflow is to inventory exposure, choose who should reach each service, change its mapping, and test from outside the VPS. A green “active” status in UFW is not proof that a container port is private.</p>



<p class="wp-block-paragraph">This guide covers rootful Docker Engine with bridge networking on an Ubuntu VPS. Host networking, Swarm ingress, rootless Docker and routed container networks require their own review. Before changing firewall rules, keep your current SSH session open, confirm recovery-console access and preserve your existing configuration.</p>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><div><div><a href="#why-bypass">1. Why Docker-published ports can bypass UFW</a></div><div><a href="#audit">2. Audit mappings, network mode and firewall backend</a></div><div><a href="#choose-access">3. Decide which services actually need a public port</a></div><div><a href="#loopback">4. Bind host-only services to loopback</a></div><div><a href="#apply">5. Apply Compose changes without losing persistent data</a></div><div><a href="#iptables">6. Use DOCKER-USER for deliberate iptables filtering</a></div><div><a href="#nftables">7. Treat native nftables and host networking separately</a></div><div><a href="#verify">8. Verify Docker and UFW from outside the VPS</a></div><div><a href="#faq">Frequently asked questions</a></div></div></nav></div>



<h2 id="why-bypass" class="wp-block-heading">1. Why Docker-published ports can bypass UFW</h2>



<p class="wp-block-paragraph">UFW commonly controls traffic addressed to services on the host through the INPUT path. Docker’s bridge port publishing uses destination NAT and forwarding rules. Container-bound packets can therefore take a different path before the usual host-service rules apply. Docker documents this <a href="https://docs.docker.com/engine/network/packet-filtering-firewalls/" rel="noopener">UFW incompatibility</a>.</p>



<p class="wp-block-paragraph">For example, a host-installed SSH service on port 22 and a container mapped from host port 8080 to container port 80 need different checks. Adding <code>ufw deny 8080/tcp</code> does not establish that the Docker mapping is blocked.</p>



<p class="wp-block-paragraph">Keep UFW for appropriate host-service policy. Review Docker exposure alongside it. Do not set Docker’s <code>iptables</code> or <code>ip6tables</code> options to false as a shortcut: this can break masquerading and container networking without delivering the intended protection.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1536" height="1024" src="https://blog.aveshost.com/wp-content/uploads/2026/11/docker-ufw-traffic-paths.webp" alt="Docker and UFW traffic paths comparing host INPUT filtering with Docker DNAT and FORWARD traffic to a container." class="wp-image-6015" srcset="https://blog.aveshost.com/wp-content/uploads/2026/11/docker-ufw-traffic-paths.webp 1536w, https://blog.aveshost.com/wp-content/uploads/2026/11/docker-ufw-traffic-paths-300x200.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/11/docker-ufw-traffic-paths-1024x683.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/11/docker-ufw-traffic-paths-768x512.webp 768w" sizes="(max-width: 1536px) 100vw, 1536px" /></figure>



<h2 id="audit" class="wp-block-heading">2. Audit mappings, network mode and firewall backend</h2>



<p class="wp-block-paragraph">Start with read-only checks. Replace <code>web</code> with the container you are investigating:</p>



<pre class="wp-block-code"><code>sudo docker version
sudo docker ps --format 'table {{.Names}}	{{.Ports}}'
sudo docker port web
sudo docker inspect web --format '{{.HostConfig.NetworkMode}}'
sudo ufw status verbose
ip -br address</code></pre>



<p class="wp-block-paragraph">In <code>docker ps</code>, <code>0.0.0.0:8080-&gt;80/tcp</code> indicates an IPv4 wildcard mapping; <code>[::]:8080-&gt;80/tcp</code> indicates an IPv6 wildcard mapping. A plain <code>80/tcp</code> entry is an exposed container port, not by itself a host publication. The <a href="https://docs.docker.com/reference/cli/docker/container/port/" rel="noopener">docker port command</a> lists actual mappings.</p>



<p class="wp-block-paragraph">Check the effective Compose configuration with <code>sudo docker compose config</code> from the project directory. Include the same override files and environment inputs used during deployment. Its rendered output can contain secrets; inspect it locally and redact it before sharing.</p>



<p class="wp-block-paragraph">For backend diagnosis, inspect <code>sudo systemctl cat docker</code> and, if present, <code>/etc/docker/daemon.json</code>. Then inspect <code>sudo iptables -S DOCKER-USER</code> and, where available, <code>sudo nft list ruleset</code>. Do not infer Docker’s native backend solely from <code>iptables --version</code>: an <code>nf_tables</code> version string can mean the iptables compatibility frontend.</p>



<h2 id="choose-access" class="wp-block-heading">3. Decide which services actually need a public port</h2>



<p class="wp-block-paragraph">Build a short access list before editing anything. A website, its database and its administration screen rarely need identical reachability. Record the owner and intended clients for every published port.</p>



<p class="wp-block-paragraph">For container-to-container traffic, attach the services to an appropriate shared Docker network and use service names, such as <code>db:5432</code>. Remove the database’s host <code>ports:</code> mapping when no external client needs it. Compose networking provides service discovery; <code>expose:</code> is not a firewall or a host-port publication.</p>



<p class="wp-block-paragraph">Limit shared-network membership too: removing a host mapping does not prevent peer containers on that network from reaching the service. Docker’s <a href="https://docs.docker.com/reference/compose-file/networks/" rel="noopener">Compose networking reference</a> describes network membership.</p>



<p class="wp-block-paragraph">For remote maintenance, prefer an authenticated VPN or SSH tunnel instead of a public database or dashboard port. A deliberately public service still needs authentication, updates and application-level access controls.</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Client</th><th>Suitable arrangement</th><th>Public host mapping</th></tr></thead><tbody><tr><td>Another container</td><td>Shared network; service-name connection</td><td>Usually none</td></tr><tr><td>Reverse proxy installed on host</td><td>Backend bound to loopback</td><td>Backend stays local</td></tr><tr><td>Visitors to a website</td><td>Public proxy with private backends</td><td>Only required web ports</td></tr><tr><td>Administrator</td><td>VPN or SSH tunnel</td><td>Avoid direct public admin port</td></tr></tbody></table></figure>



<h2 id="loopback" class="wp-block-heading">4. Bind host-only services to loopback</h2>



<p class="wp-block-paragraph">If a reverse proxy installed directly on the VPS needs to reach a container, change the mapping from <code>8080:80</code> to <code>127.0.0.1:8080:80</code>. Merge this fragment into the existing service, preserving its image, volumes, environment and other settings:</p>



<pre class="wp-block-code"><code>services:
  app:
    ports:
      - "127.0.0.1:8080:80"</code></pre>



<p class="wp-block-paragraph">Point the host proxy at <code>http://127.0.0.1:8080</code>. The application inside the container normally still listens on its container interface, often <code>0.0.0.0:80</code>. Binding the host side and binding inside the container are different settings.</p>



<p class="wp-block-paragraph">If the reverse proxy is also a container, its <code>127.0.0.1</code> refers to itself. Put proxy and application on a suitable shared network, use an upstream such as <code>app:80</code>, and remove the application’s host mapping.</p>



<p class="wp-block-paragraph">Without a host address, published mappings normally bind all host addresses. Review IPv6 mappings separately. Docker also warns that releases older than 28.0.0 have a same-L2 reachability issue for localhost-published ports; upgrade before relying on that boundary. See <a href="https://docs.docker.com/engine/network/port-publishing/" rel="noopener">Docker’s port-publishing documentation</a>.</p>



<p class="wp-block-paragraph">For a temporary SSH tunnel, run this on your workstation, replacing the username and VPS address:</p>



<pre class="wp-block-code"><code>ssh -N -L 127.0.0.1:18080:127.0.0.1:8080 user@VPS_ADDRESS</code></pre>



<p class="wp-block-paragraph">Then visit <code>http://127.0.0.1:18080</code> locally. The SSH account must be permitted to forward connections. This example follows the <a href="https://man.openbsd.org/ssh#L" rel="noopener">OpenSSH local-forwarding syntax</a>; the tunnel ends when that SSH connection ends.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1536" height="1024" src="https://blog.aveshost.com/wp-content/uploads/2026/11/docker-minimal-port-exposure.webp" alt="Four Docker access patterns: private container networks, host loopback, public web proxy and VPN or SSH administration." class="wp-image-6016" srcset="https://blog.aveshost.com/wp-content/uploads/2026/11/docker-minimal-port-exposure.webp 1536w, https://blog.aveshost.com/wp-content/uploads/2026/11/docker-minimal-port-exposure-300x200.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/11/docker-minimal-port-exposure-1024x683.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/11/docker-minimal-port-exposure-768x512.webp 768w" sizes="(max-width: 1536px) 100vw, 1536px" /></figure>



<h2 id="apply" class="wp-block-heading">5. Apply Compose changes without losing persistent data</h2>



<p class="wp-block-paragraph">Before recreation, verify backups and persistent mounts. Files stored only in a container’s writable layer can be lost when it is replaced. Arrange a maintenance window for services that cannot tolerate interruption.</p>



<p class="wp-block-paragraph">Check the merged configuration for both the intended loopback mapping and any old wildcard mapping. Compose override files or a deployment platform can reintroduce ports. Edit the configuration that actually owns the deployment.</p>



<pre class="wp-block-code"><code>sudo docker compose config
sudo docker compose up -d --no-deps app
sudo docker compose ps
sudo docker port YOUR_APP_CONTAINER</code></pre>



<p class="wp-block-paragraph">Replace the service and container names with your own. <code>compose up</code> recreates a service when its configuration changes; a plain restart does not apply a changed port mapping. See the <a href="https://docs.docker.com/reference/cli/docker/compose/up/" rel="noopener">Compose up reference</a>.</p>



<p class="wp-block-paragraph">Check the website, health endpoint and database connection immediately. If rollback is needed, restore the reviewed configuration and redeploy that service. Do not use <code>docker compose down -v</code> for a port change; deleting volumes is unnecessary and can destroy persistent data.</p>



<h2 id="iptables" class="wp-block-heading">6. Use DOCKER-USER for deliberate iptables filtering</h2>



<p class="wp-block-paragraph">For Docker’s iptables backend, user restrictions belong in <code>DOCKER-USER</code>, before Docker’s forwarding decisions. DNAT has already happened there, so matching the original published host port requires conntrack. Its use can add processing overhead. Follow <a href="https://docs.docker.com/engine/network/firewall-iptables/" rel="noopener">Docker’s iptables guidance</a>.</p>



<p class="wp-block-paragraph">Here is a narrow IPv4/TCP example for a standard VPS that is not routing unrelated networks. It drops traffic entering <code>ens3</code> to original destination port 8080 unless its source is <code>198.51.100.10</code>. Replace the interface and documentation-only source address first; it covers that port on all destination addresses reached through the interface:</p>



<pre class="wp-block-code"><code>sudo iptables -I DOCKER-USER 1 -i ens3 -p tcp ! -s 198.51.100.10/32 -m conntrack --ctdir ORIGINAL --ctorigdstport 8080 -j DROP</code></pre>



<p class="wp-block-paragraph">The permitted source continues through existing rules; this does not override other restrictions. ORIGINAL direction avoids dropping return packets for container-initiated connections. Inspect rule counters and test with fresh connections from permitted and denied clients:</p>



<pre class="wp-block-code"><code>sudo iptables -vnL DOCKER-USER --line-numbers</code></pre>



<p class="wp-block-paragraph">To remove exactly the example rule, use the same arguments with <code>-D</code>:</p>



<pre class="wp-block-code"><code>sudo iptables -D DOCKER-USER -i ens3 -p tcp ! -s 198.51.100.10/32 -m conntrack --ctdir ORIGINAL --ctorigdstport 8080 -j DROP</code></pre>



<p class="wp-block-paragraph">This rule covers neither UDP nor IPv6. Before relying on it, review those paths and your existing rule order. Make persistence explicit using your firewall-management process, ensure the chain exists before restoring the rule, and test after Docker restarts and a reboot. Do not flush Docker’s chains.</p>



<h2 id="nftables" class="wp-block-heading">7. Treat native nftables and host networking separately</h2>



<p class="wp-block-paragraph">Docker’s native nftables backend has no <code>DOCKER-USER</code> chain. Custom filtering belongs in separate tables and base chains at suitable hook priorities; do not edit Docker-owned tables. Docker describes support introduced in Engine 29.0.0 as experimental at the time of writing. Consult its <a href="https://docs.docker.com/engine/network/firewall-nftables/" rel="noopener">nftables documentation</a> for the installed release.</p>



<p class="wp-block-paragraph">A chain left over from a previous iptables configuration does not prove it will keep protecting traffic after a backend switch or reboot. Do not switch backends merely to make a copied command run. Use loopback or remove publication while a qualified administrator designs the required rules.</p>



<p class="wp-block-paragraph">With <code>network_mode: host</code>, containers share the host network namespace and port-publishing settings do not provide isolation. Audit application listeners and host firewall policy directly; see the <a href="https://docs.docker.com/engine/network/drivers/host/" rel="noopener">host-network driver documentation</a>. If a service unexpectedly uses host mode, changing its <code>ports:</code> list will not solve the exposure.</p>



<h2 id="verify" class="wp-block-heading">8. Verify Docker and UFW from outside the VPS</h2>



<p class="wp-block-paragraph">From an external workstation you control, test the VPS’s actual IPv4 and IPv6 addresses. For the example TCP port, using OpenBSD-style netcat:</p>



<pre class="wp-block-code"><code>nc -4 -vz -w 3 VPS_IPV4 8080
nc -6 -vz -w 3 VPS_IPV6 8080</code></pre>



<p class="wp-block-paragraph">A private backend should fail externally while its intended local proxy or tunnel still works. For a source allowlist, test from both permitted and denied networks. Test public HTTPS and open a second SSH session before closing the first. A test from the VPS itself does not exercise the same incoming path.</p>



<p class="wp-block-paragraph">A timeout alone cannot identify which layer blocked traffic. Compare mapping output, rule counters and application health; upstream firewalls can mask a host misconfiguration. Repeat after redeployment, firewall reload, Docker restart and a planned reboot. Review UDP services separately rather than treating a TCP result as proof.</p>



<p class="wp-block-paragraph">Keep UFW’s host rules aligned with the services you intentionally run, using the <a href="https://ubuntu.com/server/docs/how-to/security/firewalls/" rel="noopener">Ubuntu firewall guide</a>. If an upstream VPS firewall is available, use it as another layer, with separate IPv4 and IPv6 policy.</p>



<p class="wp-block-paragraph">For a deployment you maintain yourself, explore our <a href="https://www.aveshost.com/self-managed-vps-hosting" rel="noopener">self-managed VPS hosting</a>. If you need help reviewing an Aveshost server, <a href="https://www.aveshost.com/support" rel="noopener">contact our support team</a> with redacted port mappings and the intended access list. Our <a href="https://blog.aveshost.com/docker-disk-space-full/">Docker storage troubleshooting guide</a> covers another common VPS maintenance problem.</p>



<h2 id="faq" class="wp-block-heading">Frequently asked questions</h2>


<div id="rank-math-faq" class="rank-math-block">
<div class="rank-math-list ">
<div id="faq-question-096838292548430796504dd2f68da213" class="rank-math-list-item">
<h3 class="rank-math-question ">Does ufw deny 8080 guarantee a Docker container is blocked?</h3>
<div class="rank-math-answer ">

<p>No. A bridge-network published port can take Docker’s forwarding path instead of the host INPUT path. Remove or narrow the mapping, or apply backend-appropriate filtering, then verify externally.</p>

</div>
</div>
<div id="faq-question-ca7e291839414cb09f8af6b9e65af158" class="rank-math-list-item">
<h3 class="rank-math-question ">Does EXPOSE in a Dockerfile publish a public port?</h3>
<div class="rank-math-answer ">

<p>EXPOSE documents intended container ports. Host publication is a separate operation. Audit explicit publish flags, publish-all flags, Compose ports and deployment-platform settings.</p>

</div>
</div>
<div id="faq-question-1b3a26b573174e8d84105bd18d2fe5ba" class="rank-math-list-item">
<h3 class="rank-math-question ">Can another container reach a service bound to host loopback?</h3>
<div class="rank-math-answer ">

<p>A host loopback binding restricts that host publication. Peer containers sharing the application network may still reach its container port directly. Control network membership and application authentication too.</p>

</div>
</div>
<div id="faq-question-c5962ad8eb25410a9e52f4e0c4fc9301" class="rank-math-list-item">
<h3 class="rank-math-question ">Should I disable Docker iptables integration to fix UFW?</h3>
<div class="rank-math-answer ">

<p>That is not a general fix. Docker relies on generated networking rules, and disabling them requires a complete replacement design. Prefer reducing published ports and applying filtering for the active backend.</p>

</div>
</div>
<div id="faq-question-86e877aeedd248e39fad306bddf8426e" class="rank-math-list-item">
<h3 class="rank-math-question ">Why can I still reach the old port after editing Compose?</h3>
<div class="rank-math-answer ">

<p>Check whether the container was recreated, whether an override file retained the mapping, and whether another container or host process owns the port. Compare the rendered configuration with actual mappings and repeat an external test.</p>

</div>
</div>
</div>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://blog.aveshost.com/docker-ufw-unexpected-ports/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Docker Disk Space Full? How to Find What Is Using Your VPS Storage</title>
		<link>https://blog.aveshost.com/docker-disk-space-full/</link>
					<comments>https://blog.aveshost.com/docker-disk-space-full/#respond</comments>
		
		<dc:creator><![CDATA[James Wilson]]></dc:creator>
		<pubDate>Thu, 19 Nov 2026 17:17:25 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Hosting]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux VPS]]></category>
		<category><![CDATA[VPS storage]]></category>
		<guid isPermaLink="false">https://blog.aveshost.com/?p=6005</guid>

					<description><![CDATA[Find what is filling your Docker VPS with practical Linux commands, targeted cleanup guidance, log rotation and checks that protect persistent data.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">When you see a <strong>Docker disk space full</strong> error, start with <code>df -h</code>, <code>df -i</code> and <code>docker system df -v</code>. Together, they show whether the problem is filesystem capacity, exhausted inodes or Docker objects. The largest culprit may be container logs, database volumes, build cache or backups outside Docker.</p>



<p class="wp-block-paragraph">Our approach is to measure first, identify the owner of the data, and remove only what you can safely replace. A database volume can be essential even when Docker calls it unused. Never delete files directly from Docker’s internal storage directories to make an alert disappear.</p>



<p class="wp-block-paragraph">This guide covers Docker Engine on a Linux VPS, with GNU/Linux commands suitable for Ubuntu and Debian. Connect over SSH using an account with sudo rights. Docker commands below use <code>sudo</code> for a rootful installation; for rootless Docker, run them as the owning user without sudo.</p>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><div><div><a href="#check-filesystem">1. Check disk capacity and inodes first</a></div><div><a href="#locate-directories">2. Find the largest host directories</a></div><div><a href="#docker-usage">3. Compare Docker images, containers and build cache</a></div><div><a href="#volumes-mounts">4. Trace persistent volumes and bind mounts</a></div><div><a href="#logs-hidden-space">5. Check logs and space that du cannot explain</a></div><div><a href="#targeted-cleanup">6. Reclaim space with targeted cleanup</a></div><div><a href="#rotation">7. Prevent Docker disk space full errors with log rotation</a></div><div><a href="#verify-capacity">8. Recheck storage and decide whether to expand</a></div><div><a href="#faq">Frequently asked questions</a></div></div></nav></div>



<h2 id="check-filesystem" class="wp-block-heading">1. Check disk capacity and inodes first</h2>



<p class="wp-block-paragraph">Run these read-only checks before any cleanup:</p>



<pre class="wp-block-code"><code>df -h
df -i
lsblk -f</code></pre>



<p class="wp-block-paragraph">In <code>df -h</code>, check the filesystem containing the failing path and its <code>Avail</code>, <code>Use%</code> and mount point. A full root filesystem can stop image pulls, database writes and deployments. Repeated overlay entries often report the same backing filesystem; do not add their sizes together.</p>



<p class="wp-block-paragraph">In <code>df -i</code>, a filesystem at 100% inode usage can reject new files despite having free bytes. Large numbers of tiny cache or session files can cause this. <code>lsblk -f</code> helps identify disks and mount points. See the <a href="https://www.gnu.org/software/coreutils/manual/html_node/df-invocation.html" rel="noopener">GNU df documentation</a> for these filesystem checks.</p>



<p class="wp-block-paragraph">If production writes are already failing, pause nonessential builds, imports and backup jobs while you investigate. Avoid writing a fresh backup onto the full filesystem; use a verified off-server destination. Do not repeatedly restart a database that has no room to recover.</p>



<h2 id="locate-directories" class="wp-block-heading">2. Find the largest host directories</h2>



<p class="wp-block-paragraph">Start at the affected mount point. For a full root filesystem:</p>



<pre class="wp-block-code"><code>sudo du -xhd1 / 2&gt;/dev/null | sort -h
sudo du -xhd1 /var 2&gt;/dev/null | sort -h
sudo du -xhd1 /var/lib 2&gt;/dev/null | sort -h</code></pre>



<p class="wp-block-paragraph">The <code>-x</code> option stays on one filesystem and <code>-d1</code> limits the displayed depth. Repeat against the biggest directory. If Docker or application data lives on a separate mounted disk, scan that mount separately. Permission or I/O errors hidden by the redirection still need investigation if totals look incomplete.</p>



<p class="wp-block-paragraph">Check <code>/var/log</code>, application uploads, deployment folders and local backup archives as well as Docker. Directory scans can create noticeable I/O on busy servers; run them one level at a time. The <a href="https://www.gnu.org/software/coreutils/manual/html_node/du-invocation.html" rel="noopener">GNU du manual</a> explains these options.</p>



<p class="wp-block-paragraph">Locate Docker’s configured data root and storage backend:</p>



<pre class="wp-block-code"><code>sudo docker info --format '{{.DockerRootDir}}'
sudo docker info</code></pre>



<p class="wp-block-paragraph">The usual rootful data directory is <code>/var/lib/docker</code>, but fresh Docker Engine 29.0 and later installations use the containerd image store by default. Image contents and container snapshots then live under <code>/var/lib/containerd</code>, while volumes and other Docker data remain under the Docker data root. Custom and rootless installations differ. Changing Docker’s <code>data-root</code> does not move containerd’s separate data; check the <a href="https://docs.docker.com/engine/daemon/" rel="noopener">daemon storage documentation</a>.</p>



<h2 id="docker-usage" class="wp-block-heading">3. Compare Docker images, containers and build cache</h2>



<pre class="wp-block-code"><code>sudo docker system df -v
sudo docker ps -a --size
sudo docker image ls
sudo docker buildx du</code></pre>



<p class="wp-block-paragraph">The verbose <code>docker system df</code> output separates images, containers, local volumes and build cache. Shared image layers mean individual image sizes cannot simply be added together. “Reclaimable” describes Docker references; it does not tell you whether an old deployment or its data matters to your business.</p>



<p class="wp-block-paragraph">The size shown by <code>docker ps --size</code> measures container writable layers. It excludes mounted data and logging-driver files, so a small container can still be responsible for substantial disk usage. See Docker’s <a href="https://docs.docker.com/engine/storage/drivers/" rel="noopener">writable-layer explanation</a>.</p>



<p class="wp-block-paragraph">If you use Buildx, <code>docker buildx du</code> reports cache for the selected builder. Other builders can retain separate caches. If the command is unavailable, check whether Buildx is installed; do not install extra tooling during an outage simply to follow this optional check.</p>



<p class="wp-block-paragraph">For example, if the filesystem has 72 GB used but Docker objects explain only 28 GB, investigate logs, bind mounts, backups and host files. These example totals illustrate the investigation; they are not a complete accounting formula.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1536" height="1024" src="https://blog.aveshost.com/wp-content/uploads/2026/11/docker-vps-storage-breakdown.webp" alt="Six VPS storage consumers: Docker images, writable layers, volumes, bind mounts, container logs and host files." class="wp-image-6007" srcset="https://blog.aveshost.com/wp-content/uploads/2026/11/docker-vps-storage-breakdown.webp 1536w, https://blog.aveshost.com/wp-content/uploads/2026/11/docker-vps-storage-breakdown-300x200.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/11/docker-vps-storage-breakdown-1024x683.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/11/docker-vps-storage-breakdown-768x512.webp 768w" sizes="(max-width: 1536px) 100vw, 1536px" /></figure>



<h2 id="volumes-mounts" class="wp-block-heading">4. Trace persistent volumes and bind mounts</h2>



<p class="wp-block-paragraph">Replace <code>app</code> and <code>app_data</code> below with names from your own server:</p>



<pre class="wp-block-code"><code>sudo docker inspect app --format '{{json .Mounts}}'
sudo docker volume ls
sudo docker volume inspect app_data
sudo docker ps -a --filter volume=app_data</code></pre>



<p class="wp-block-paragraph">The mount list identifies whether a container writes to a Docker volume or a host bind mount. For a bind mount, inspect the reported host source directory with <code>du</code>. For local volumes, compare the volume names and sizes in <code>docker system df -v</code>; remote volume drivers need their own storage checks.</p>



<p class="wp-block-paragraph">A PostgreSQL data volume, an upload directory or n8n’s persistent data can grow even when application images stay small. Use the application’s retention and maintenance tools after checking backups. Never manually remove PostgreSQL WAL files, database table files or Docker layer directories.</p>



<p class="wp-block-paragraph">Before removing a volume, establish which service owns it, whether stopped containers reference it, and whether its contents have a tested backup. An unattached volume may belong to a temporarily removed Compose project. Our <a href="https://blog.aveshost.com/supabase-vps-requirements/">Supabase VPS sizing guide</a> explains why persistent storage needs its own capacity allowance.</p>



<h2 id="logs-hidden-space" class="wp-block-heading">5. Check logs and space that du cannot explain</h2>



<p class="wp-block-paragraph">Inspect the logging driver and path for the container you suspect:</p>



<pre class="wp-block-code"><code>sudo docker inspect app --format '{{.HostConfig.LogConfig.Type}} {{.LogPath}}'
sudo journalctl --disk-usage
sudo lsof +L1</code></pre>



<p class="wp-block-paragraph">For a rootful container using a file-based driver, inspect the reported log path’s allocated size with <code>sudo du -h /exact/reported/log/path</code>. A blank path can be normal for other drivers. Repeated application errors can fill logs quickly; inspect a short recent sample with <code>sudo docker logs --tail 100 app</code>.</p>



<p class="wp-block-paragraph">Docker’s default <code>json-file</code> logging does not rotate files unless configured. Docker recommends the rotating <code>local</code> driver for many non-Kubernetes use cases. See its <a href="https://docs.docker.com/engine/logging/configure/" rel="noopener">logging-driver guidance</a>. Do not delete or truncate Docker-managed log files behind the daemon.</p>



<p class="wp-block-paragraph">If <code>df</code> shows far more use than <code>du</code>, <code>lsof +L1</code> can reveal deleted files still held open by processes. Space returns when the last open reference closes. Identify the service and plan a controlled restart or supported log reopen; do not kill unfamiliar processes. If lsof is unavailable, skip this check until suitable tooling is available.</p>



<p class="wp-block-paragraph">Filesystem metadata, reserved space and files hidden beneath mounts can also explain differences. A large systemd journal is separate from container logs. The <a href="https://www.freedesktop.org/software/systemd/man/latest/journalctl.html" rel="noopener">journalctl manual</a> documents its disk-usage and retention controls.</p>



<h2 id="targeted-cleanup" class="wp-block-heading">6. Reclaim space with targeted cleanup</h2>



<p class="wp-block-paragraph">Once you know the cause, choose a matching action. The commands in this section delete data; inspect candidates and preserve rollback requirements first. They are alternatives, not a script to run from top to bottom.</p>



<p class="wp-block-paragraph">To remove dangling images that no container references:</p>



<pre class="wp-block-code"><code>sudo docker image prune</code></pre>



<p class="wp-block-paragraph">To prune dangling build cache older than seven days with the default builder:</p>



<pre class="wp-block-code"><code>sudo docker builder prune --filter "until=168h"</code></pre>



<p class="wp-block-paragraph">To remove one confirmed disposable stopped container, including its writable layer:</p>



<pre class="wp-block-code"><code>sudo docker rm old-test-container</code></pre>



<p class="wp-block-paragraph">The first two commands prompt for confirmation. Keep those prompts. Cached build layers can be regenerated, but future builds may take longer. Retain images needed for rollback and verify registry access before removing them. The <a href="https://docs.docker.com/engine/manage-resources/pruning/" rel="noopener">Docker pruning guide</a> describes each object type.</p>



<p class="wp-block-paragraph">Avoid starting with <code>docker system prune -a --volumes</code>. System prune removes stopped containers, unused networks, image data and build cache; <code>-a</code> broadens image removal and <code>--volumes</code> adds unused anonymous volumes. Separate volume pruning with <code>-a</code> can also remove unused named volumes. “Unused” does not mean safe to lose.</p>



<p class="wp-block-paragraph">For large host journals, archive needed incident evidence first, then use an agreed retention policy. For example, <code>sudo journalctl --rotate --vacuum-size=500M</code> removes older archived journal files toward the example limit; it is not a hard cap on total journal storage. Do not remove database or upload data to hit an arbitrary free-space target.</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Space consumer</th><th>Preferred response</th><th>Main tradeoff</th></tr></thead><tbody><tr><td>Dangling images</td><td>Review and prune dangling images</td><td>May lose locally retained artifacts</td></tr><tr><td>Build cache</td><td>Prune cache for the relevant builder</td><td>Slower future builds</td></tr><tr><td>Container logs</td><td>Fix noisy app; configure rotation</td><td>Recreation may interrupt service</td></tr><tr><td>Database or uploads</td><td>Apply app retention or add capacity</td><td>Data requires verified backups</td></tr></tbody></table></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1536" height="1024" src="https://blog.aveshost.com/wp-content/uploads/2026/11/docker-storage-recovery-workflow.webp" alt="Five-step Docker storage recovery workflow: measure, locate, protect data, clean selectively and prevent repeats." class="wp-image-6008" srcset="https://blog.aveshost.com/wp-content/uploads/2026/11/docker-storage-recovery-workflow.webp 1536w, https://blog.aveshost.com/wp-content/uploads/2026/11/docker-storage-recovery-workflow-300x200.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/11/docker-storage-recovery-workflow-1024x683.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/11/docker-storage-recovery-workflow-768x512.webp 768w" sizes="(max-width: 1536px) 100vw, 1536px" /></figure>



<h2 id="rotation" class="wp-block-heading">7. Prevent Docker disk space full errors with log rotation</h2>



<p class="wp-block-paragraph">Configure rotation in the service’s Compose definition. Merge this example under the existing service instead of replacing the whole file:</p>



<pre class="wp-block-code"><code>services:
  app:
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"</code></pre>



<p class="wp-block-paragraph">This retains a bounded set of JSON log files per container, roughly 30 MB with these example settings, plus overhead. Choose limits that fit your troubleshooting and compliance needs. See the <a href="https://docs.docker.com/engine/logging/drivers/json-file/" rel="noopener">JSON-file logging options</a>. Application logs written inside volumes need their own rotation.</p>



<p class="wp-block-paragraph">Changing the definition does not retrofit existing containers. Validate with <code>docker compose config</code>, verify persistent mounts, and recreate the affected service during a suitable maintenance window. Recreation can discard files kept only in its writable layer and interrupt requests. A plain restart does not apply a new logging configuration.</p>



<p class="wp-block-paragraph">Monitor free bytes and inodes on each data filesystem. Example alerts at 80% and 90% are starting points; adjust for growth rate and response time. Keep backups off-server, enforce retention and leave room for image extraction, database maintenance and temporary deployment files.</p>



<h2 id="verify-capacity" class="wp-block-heading">8. Recheck storage and decide whether to expand</h2>



<pre class="wp-block-code"><code>df -h
df -i
sudo docker system df -v
sudo docker ps</code></pre>



<p class="wp-block-paragraph">Compare the same filesystem before and after cleanup. Check the application’s health endpoint, perform a normal read/write transaction and confirm scheduled backups still work. If usage climbs again immediately, address the writer or retention policy rather than repeating broad pruning.</p>



<p class="wp-block-paragraph">If required application data dominates storage, additional capacity may be the right fix. A larger virtual disk may still need partition and filesystem expansion inside Linux; follow the procedure for the actual filesystem. Plan storage moves for Docker and containerd separately.</p>



<p class="wp-block-paragraph">For a new deployment, explore our <a href="https://www.aveshost.com/self-managed-vps-hosting" rel="noopener">self-managed VPS hosting</a> and size storage for persistent data, logs, builds and backup staging. If you need help assessing a running Aveshost server, <a href="https://www.aveshost.com/support" rel="noopener">contact our support team</a> with the filesystem figures and largest directories. Redact credentials and private application data before sharing diagnostic output.</p>



<h2 id="faq" class="wp-block-heading">Frequently asked questions</h2>


<div id="rank-math-faq" class="rank-math-block">
<div class="rank-math-list ">
<div id="faq-question-9b639d933b26468dafe46553c592fe5e" class="rank-math-list-item">
<h3 class="rank-math-question ">Why is my VPS full when Docker reports little disk usage?</h3>
<div class="rank-math-answer ">

<p>Docker object totals do not explain every host file. Check bind-mounted data, logging-driver files, local backups, system journals and deleted files held open by processes. Confirm which filesystem is full before comparing totals.</p>

</div>
</div>
<div id="faq-question-2f3d0f198e4c43a9b9a68110767b7f21" class="rank-math-list-item">
<h3 class="rank-math-question ">Can I delete /var/lib/docker/overlay2 to free space?</h3>
<div class="rank-math-answer ">

<p>No. Docker manages layer files and metadata together. Manual deletion can corrupt containers and images. Identify disposable objects through Docker commands, preserve persistent data and use supported removal operations.</p>

</div>
</div>
<div id="faq-question-5aef7d8b21e04187879edd5cb7ec34bb" class="rank-math-list-item">
<h3 class="rank-math-question ">Does docker system prune remove running containers?</h3>
<div class="rank-math-answer ">

<p>It does not remove running containers, but it removes stopped containers and other unused objects. Flags broaden its scope. A stopped container can contain valuable writable-layer data, so review what you need before confirming.</p>

</div>
</div>
<div id="faq-question-67cd483b664b44aba8b9f89a2f3e92b3" class="rank-math-list-item">
<h3 class="rank-math-question ">Why does Docker still say no space left when df -h shows free space?</h3>
<div class="rank-math-answer ">

<p>Check inode usage with df -i and inspect the filesystem containing the exact failing path. A separate full mount, a quota or a filesystem-specific limit can also block writes while another filesystem has free capacity.</p>

</div>
</div>
<div id="faq-question-eec221d9fabd402b923397319548e681" class="rank-math-list-item">
<h3 class="rank-math-question ">Will increasing VPS RAM fix a full Docker disk?</h3>
<div class="rank-math-answer ">

<p>Additional RAM does not increase disk capacity. Reclaim confirmed disposable storage, reduce growth or expand storage. Investigate swap separately if it is a significant disk consumer; removing it without a memory plan can destabilise services.</p>

</div>
</div>
</div>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://blog.aveshost.com/docker-disk-space-full/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Install Hermes Agent on an Ubuntu VPS and Keep It Running 24/7</title>
		<link>https://blog.aveshost.com/install-hermes-agent-on-an-ubuntu-vps/</link>
					<comments>https://blog.aveshost.com/install-hermes-agent-on-an-ubuntu-vps/#respond</comments>
		
		<dc:creator><![CDATA[James Wilson]]></dc:creator>
		<pubDate>Sun, 08 Nov 2026 20:55:52 +0000</pubDate>
				<category><![CDATA[Web Hosting]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[AI agents]]></category>
		<category><![CDATA[Hermes Agent]]></category>
		<category><![CDATA[Linux VPS]]></category>
		<category><![CDATA[systemd]]></category>
		<category><![CDATA[Ubuntu VPS]]></category>
		<guid isPermaLink="false">https://blog.aveshost.com/?p=5887</guid>

					<description><![CDATA[A step-by-step guide to installing Nous Research's Hermes Agent on an Ubuntu VPS, securing the messaging gateway for Telegram or Discord, and running it 24/7 with systemd.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Learning how to <strong>install Hermes Agent on an Ubuntu VPS</strong> lets you run a persistent, self-improving AI assistant that stays online 24/7 without tying up your local laptop. Built by <a href="https://github.com/NousResearch/hermes-agent" rel="noopener">Nous Research</a>, Hermes Agent combines multi-model LLM routing, persistent cross-session memory, autonomous skill creation, Model Context Protocol (MCP) tools, and a built-in messaging gateway for Telegram, Discord, and Slack.</p>



<p class="wp-block-paragraph">When you deploy Hermes Agent on an <a href="https://www.aveshost.com/self-managed-vps-hosting" rel="noopener">Aveshost Self-Managed VPS</a> or high-frequency <a href="https://www.aveshost.com/vds-ghana" rel="noopener">Aveshost VDS</a> running Ubuntu 22.04 or 24.04 LTS, your agent can execute scheduled cron jobs, monitor infrastructure, and reply to your private Telegram or Discord messages around the clock.</p>



<p class="wp-block-paragraph">In this guide, you will learn how to create an isolated non-root Linux user, install Hermes Agent via the official CLI installer, connect your LLM provider and messaging gateway, lock down access with user allowlists, and configure a self-healing <code>systemd</code> daemon so your agent automatically restarts after crashes or server reboots.</p>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><div><div><a href="#why-run-hermes-agent-on-an-ubuntu-vps-with-systemd">Why Run Hermes Agent on an Ubuntu VPS with Systemd?</a></div><div><a href="#step-1-prepare-your-ubuntu-vps-and-create-a-non-root-user">Step 1: Prepare Your Ubuntu VPS and Create a Non-Root User</a></div><div><a href="#step-2-install-hermes-agent-and-verify-dependencies">Step 2: Install Hermes Agent on an Ubuntu VPS and Verify Dependencies</a></div><div><a href="#step-3-configure-your-llm-provider-and-messaging-gateway">Step 3: Configure Your LLM Provider and Messaging Gateway</a></div><div><a href="#step-4-keep-hermes-agent-running-24-7-as-a-systemd-service">Step 4: Keep Hermes Agent Running 24/7 as a Systemd Service</a></div><div><a href="#step-5-monitor-logs-update-hermes-and-manage-memory">Step 5: Monitor Logs, Update Hermes and Manage Memory</a></div><div><a href="#faq">Frequently asked questions</a></div></div></nav></div>



<h2 id="why-run-hermes-agent-on-an-ubuntu-vps-with-systemd" class="wp-block-heading">Why Run Hermes Agent on an Ubuntu VPS with Systemd?</h2>



<p class="wp-block-paragraph">If you launch <code>hermes</code> or <code>hermes gateway</code> directly inside a standard SSH terminal window, Linux attaches the process to your active pseudo-terminal session. The moment your laptop goes to sleep or your Wi-Fi drops, the operating system sends a <code>SIGHUP</code> signal and terminates your agent.</p>



<p class="wp-block-paragraph">To keep Hermes Agent running 24/7 in production, you need a process supervisor that launches the gateway at boot, captures structured logs, and restarts the agent automatically if an API timeout or out-of-memory event occurs.</p>



<p class="wp-block-paragraph">Here is how the four common ways to <strong>install Hermes Agent on an Ubuntu VPS</strong> and keep it running compare:</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Execution Method</th><th>Survives SSH Disconnect?</th><th>Auto-Restarts on Crash or Reboot?</th><th>Centralized Log Rotation?</th><th>Best Use Case</th></tr></thead><tbody><tr><td>Foreground SSH Session (hermes)</td><td>No (stops when SSH closes)</td><td>No</td><td>No</td><td>Initial setup, interactive debugging, and one-off CLI tasks</td></tr><tr><td>Terminal Multiplexer (tmux / screen)</td><td>Yes</td><td>No (dies on VPS reboot or fatal crash)</td><td>No</td><td>Short-term interactive testing over SSH</td></tr><tr><td>Systemd Service + Linger (hermes gateway install)</td><td>Yes</td><td>Yes (Restart=always &amp; WantedBy=default.target)</td><td>Yes (via journalctl)</td><td>Recommended for 24/7 production VPS deployments</td></tr><tr><td>Docker Container (&#8211;restart unless-stopped)</td><td>Yes</td><td>Yes</td><td>Yes (docker logs)</td><td>Strict filesystem isolation or multi-container stacks</td></tr></tbody></table></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1264" height="848" src="https://blog.aveshost.com/wp-content/uploads/2026/11/hermes-agent-ubuntu-vps-architecture.webp" alt="Hermes Agent 24/7 Ubuntu VPS architecture connecting Telegram and Discord channels to systemd gateway and LLM tools" class="wp-image-5889" srcset="https://blog.aveshost.com/wp-content/uploads/2026/11/hermes-agent-ubuntu-vps-architecture.webp 1264w, https://blog.aveshost.com/wp-content/uploads/2026/11/hermes-agent-ubuntu-vps-architecture-300x201.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/11/hermes-agent-ubuntu-vps-architecture-1024x687.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/11/hermes-agent-ubuntu-vps-architecture-768x515.webp 768w" sizes="(max-width: 1264px) 100vw, 1264px" /></figure>



<h2 id="step-1-prepare-your-ubuntu-vps-and-create-a-non-root-user" class="wp-block-heading">Step 1: Prepare Your Ubuntu VPS and Create a Non-Root User</h2>



<p class="wp-block-paragraph">Because Hermes Agent can execute shell commands, Python scripts, and file operations, you should <strong>never</strong> run it as <code>root</code>. Creating a dedicated non-root Linux account (such as <code>hermes</code>) ensures the agent only has permission to modify its own home directory (<code>/home/hermes</code>).</p>



<p class="wp-block-paragraph"> Regarding hardware sizing, Hermes Agent itself is lightweight because LLM inference happens via API (such as Nous Portal, OpenRouter, or Anthropic). An Ubuntu 22.04 or 24.04 LTS VPS with <strong>2 vCPU cores, 2 GB to 4 GB of RAM, and 25 GB of SSD/NVMe storage</strong> comfortably handles the Python runtime, headless browser tools, and local SQLite session memory. (If you are upgrading an older server first, see our guide on how to <a href="https://blog.aveshost.com/migrate-linux-vps-to-ubuntu/">migrate a Linux VPS to Ubuntu</a>.)</p>



<p class="wp-block-paragraph">Connect to your VPS via SSH as <code>root</code>, update your system packages, enable the UFW firewall, and create the dedicated <code>hermes</code> user:</p>



<pre class="wp-block-code"><code># 1. Update Ubuntu packages and install essential build tools
sudo apt update &amp;&amp; sudo apt upgrade -y
sudo apt install -y curl git ufw build-essential

# 2. Allow SSH through the firewall and enable UFW
sudo ufw allow OpenSSH
sudo ufw --force enable

# 3. Create a dedicated non-root user for Hermes Agent
sudo adduser --disabled-password --gecos "" hermes
sudo usermod -aG sudo hermes

# 4. Switch into the new hermes user session
sudo su - hermes</code></pre>



<p class="wp-block-paragraph">Note that Hermes Agent&#8217;s Telegram, Discord, and Slack gateways use outbound WebSocket and HTTPS long-polling connections, so you do not need to open any extra inbound ports in UFW.</p>



<h2 id="step-2-install-hermes-agent-and-verify-dependencies" class="wp-block-heading">Step 2: Install Hermes Agent on an Ubuntu VPS and Verify Dependencies</h2>



<p class="wp-block-paragraph">Logged in as the <code>hermes</code> user, run the official Nous Research installation script. The installer automatically sets up the <code>uv</code> Python package manager, creates an isolated virtual environment, clones the repository into <code>~/.hermes/hermes-agent</code>, and links the <code>hermes</code> executable into <code>~/.local/bin/hermes</code>:</p>



<p class="wp-block-paragraph">Run these commands to install Hermes Agent and verify your environment:</p>



<pre class="wp-block-code"><code># 1. Run the official Hermes Agent installer script
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash

# 2. Reload your shell profile so ~/.local/bin is in your PATH
source ~/.bashrc

# 3. Run the built-in diagnostic check
hermes doctor</code></pre>



<p class="wp-block-paragraph">When <code>hermes doctor</code> finishes, confirm that Python, <code>uv</code>, Git, and the <code>~/.hermes/</code> data directory show green checkmarks before configuring your model credentials.</p>



<h2 id="step-3-configure-your-llm-provider-and-messaging-gateway" class="wp-block-heading">Step 3: Configure Your LLM Provider and Messaging Gateway</h2>



<p class="wp-block-paragraph">After you <strong>install Hermes Agent on an Ubuntu VPS</strong>, connect it to your preferred language model provider and set up the messaging gateway so you can chat with your agent from Telegram or Discord.</p>



<p class="wp-block-paragraph"><strong>1. Configure Your LLM Provider:</strong> Run <code>hermes setup</code> to launch the interactive configuration wizard. You can authenticate with Nous Portal, OpenRouter, OpenAI, Anthropic, or any custom OpenAI-compatible API endpoint, and choose your default model.</p>



<p class="wp-block-paragraph"><strong>2. Set Up the Messaging Gateway:</strong> Run <code>hermes gateway setup</code> to configure your chat platform credentials (saved inside <code>~/.hermes/.env</code>).</p>



<p class="wp-block-paragraph"><strong>3. Lock Down Access with <code>ALLOWED_USERS</code> (Critical Security Step):</strong> Anyone who discovers your Telegram bot username can message it unless you restrict access to your own numeric user ID. Always set <code>TELEGRAM_ALLOWED_USERS</code> (or <code>DISCORD_ALLOWED_USERS</code>) in <code>~/.hermes/.env</code> and lock file permissions to <code>600</code>:</p>



<pre class="wp-block-code"><code># 1. Launch the interactive model and API key setup wizard
hermes setup

# 2. Launch the messaging gateway wizard (Telegram, Discord, Slack)
hermes gateway setup

# 3. Verify and lock down ~/.hermes/.env permissions
chmod 600 ~/.hermes/.env

# Example entries inside ~/.hermes/.env:
# OPENROUTER_API_KEY=sk-or-v1-your-key-here
# TELEGRAM_BOT_TOKEN=123456789:AAFyourBotFatherTokenHere
# TELEGRAM_ALLOWED_USERS=987654321</code></pre>



<p class="wp-block-paragraph">Before installing the background service, run <code>hermes gateway</code> once in the foreground and send a test message from your phone to confirm your bot replies cleanly, then press <code>Ctrl+C</code> to stop the foreground test. (If you also want to connect external tools, check out our guide on how to <a href="https://blog.aveshost.com/host-mcp-server-on-vps-https-authentication/">host an MCP server on a VPS</a> or compare with our <a href="https://blog.aveshost.com/build-an-ai-help-desk-with-openclaw/">OpenClaw AI help desk guide</a>.)</p>



<h2 id="step-4-keep-hermes-agent-running-24-7-as-a-systemd-service" class="wp-block-heading">Step 4: Keep Hermes Agent Running 24/7 as a Systemd Service</h2>



<p class="wp-block-paragraph">Once your foreground test succeeds, you have two reliable ways to register Hermes Agent with <code>systemd</code> so it runs 24/7, survives SSH disconnects, and starts automatically whenever your Ubuntu VPS reboots.</p>



<p class="wp-block-paragraph"><strong>Option A — Use the Built-In Gateway Service Installer + User Linger:</strong> Hermes includes a native subcommand (<code>hermes gateway install</code>) that creates a user-level systemd service. However, Ubuntu stops user-level services when you log out of SSH unless you enable <code>loginctl enable-linger</code> for the <code>hermes</code> user.</p>



<p class="wp-block-paragraph"><strong>Option B — Create a System-Wide <code>/etc/systemd/system/hermes-gateway.service</code> Unit:</strong> For production servers, a system-level unit file gives you explicit control over restart delays (<code>RestartSec=10</code>), environment variables, and journal logging.</p>



<p class="wp-block-paragraph">When you <strong>install Hermes Agent on an Ubuntu VPS</strong>, here are both systemd configurations so you can use whichever fits your server setup:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1264" height="848" src="https://blog.aveshost.com/wp-content/uploads/2026/11/hermes-agent-systemd-lifecycle-cheatsheet.webp" alt="Hermes Agent 24/7 Ubuntu VPS command cheat sheet for installation, gateway setup, systemd linger, and journalctl logs" class="wp-image-5890" srcset="https://blog.aveshost.com/wp-content/uploads/2026/11/hermes-agent-systemd-lifecycle-cheatsheet.webp 1264w, https://blog.aveshost.com/wp-content/uploads/2026/11/hermes-agent-systemd-lifecycle-cheatsheet-300x201.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/11/hermes-agent-systemd-lifecycle-cheatsheet-1024x687.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/11/hermes-agent-systemd-lifecycle-cheatsheet-768x515.webp 768w" sizes="(max-width: 1264px) 100vw, 1264px" /></figure>



<pre class="wp-block-code"><code># === OPTION A: Built-in User Service + Linger ===
hermes gateway install
sudo loginctl enable-linger hermes
systemctl --user enable --now hermes-gateway

# === OPTION B: System-Wide /etc/systemd/system/hermes-gateway.service ===
sudo tee /etc/systemd/system/hermes-gateway.service &gt; /dev/null &lt;&lt; 'EOF'
&#91;Unit]
Description=Hermes Agent 24/7 Gateway Service
After=network-online.target
Wants=network-online.target

&#91;Service]
Type=simple
User=hermes
Group=hermes
WorkingDirectory=/home/hermes
Environment="PATH=/home/hermes/.local/bin:/usr/local/bin:/usr/bin:/bin"
ExecStart=/home/hermes/.local/bin/hermes gateway run
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal

&#91;Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now hermes-gateway.service</code></pre>



<p class="wp-block-paragraph">With <code>Restart=always</code> and <code>RestartSec=10</code> configured, Ubuntu&#8217;s init system continuously supervises the gateway process and relaunches it within 10 seconds if it ever exits unexpectedly.</p>



<h2 id="step-5-monitor-logs-update-hermes-and-manage-memory" class="wp-block-heading">Step 5: Monitor Logs, Update Hermes and Manage Memory</h2>



<p class="wp-block-paragraph">After enabling your 24/7 service, you can inspect live tool executions, update Hermes Agent to the latest release, and back up your agent&#8217;s learned skills and memories without losing state.</p>



<p class="wp-block-paragraph">Once you <strong>install Hermes Agent on an Ubuntu VPS</strong>, all persistent data—including your configuration (<code>config.yaml</code>), custom skills (<code>~/.hermes/skills/</code>), long-term memory notes, and conversation history—lives inside <code>/home/hermes/.hermes/</code>.</p>



<p class="wp-block-paragraph">Use these commands after you <strong>install Hermes Agent on an Ubuntu VPS</strong> to check service health, stream real-time logs, and apply updates:</p>



<pre class="wp-block-code"><code># 1. Check that the Hermes gateway service is active (running)
sudo systemctl status hermes-gateway.service

# 2. Stream live execution logs and tool calls
sudo journalctl -u hermes-gateway.service -f

# 3. Pull the latest Hermes Agent release and restart the 24/7 gateway
hermes update
sudo systemctl restart hermes-gateway.service

# 4. Back up your agent's memory, skills, and configuration
tar -czf ~/hermes-backup-$(date +%F).tar.gz ~/.hermes/</code></pre>



<h2 id="faq" class="wp-block-heading">Frequently asked questions</h2>


<div id="rank-math-faq" class="rank-math-block">
<div class="rank-math-list ">
<div id="faq-question-3175da005da748ab836d04ee15d04b14" class="rank-math-list-item">
<h3 class="rank-math-question ">How much RAM and CPU do I need to run Hermes Agent on an Ubuntu VPS?</h3>
<div class="rank-math-answer ">

<p>Because LLM inference runs through cloud APIs (such as Nous Portal, OpenRouter, or Anthropic), Hermes Agent is very lightweight. An Ubuntu 22.04 or 24.04 LTS VPS with 2 vCPU cores, 2 GB to 4 GB of RAM, and 25 GB of SSD/NVMe disk space is plenty for running the gateway, Python tools, and MCP integrations 24/7.</p>

</div>
</div>
<div id="faq-question-8b8d1e8987314d54be421c1cad083499" class="rank-math-list-item">
<h3 class="rank-math-question ">Why does my Hermes Agent stop responding as soon as I close my SSH window?</h3>
<div class="rank-math-answer ">

<p>If you start Hermes directly in an SSH session, Linux terminates the process when the SSH connection closes. Additionally, if you installed the user-level service with hermes gateway install without enabling systemd lingering, Ubuntu stops user services on logout. Run sudo loginctl enable-linger hermes or use a system-wide unit in /etc/systemd/system/ to keep it running 24/7.</p>

</div>
</div>
<div id="faq-question-fcb9ff30c4c449db88914b748c1c3da9" class="rank-math-list-item">
<h3 class="rank-math-question ">How do I stop strangers from messaging my Hermes Agent bot on Telegram or Discord?</h3>
<div class="rank-math-answer ">

<p>Always set the TELEGRAM_ALLOWED_USERS (or DISCORD_ALLOWED_USERS) variable inside ~/.hermes/.env to your personal numeric user ID and restrict the file permissions with chmod 600 ~/.hermes/.env. Hermes will ignore messages from any user ID not on your allowlist.</p>

</div>
</div>
<div id="faq-question-35cc6d56fe5648778424e1adb5a06293" class="rank-math-list-item">
<h3 class="rank-math-question ">Where does Hermes Agent store its memory, skills, and configuration on Ubuntu?</h3>
<div class="rank-math-answer ">

<p>Hermes stores all persistent state inside the ~/.hermes/ directory in your user&#8217;s home folder (/home/hermes/.hermes/). This includes config.yaml, .env API keys, SOUL.md persona instructions, autonomous skills in ~/.hermes/skills/, and the local session database.</p>

</div>
</div>
<div id="faq-question-66c02c95729247cc9ee4289d0a7f4efe" class="rank-math-list-item">
<h3 class="rank-math-question ">Do I need to open any firewall ports on my VPS for the Hermes Telegram or Discord gateway?</h3>
<div class="rank-math-answer ">

<p>No. Both the Telegram and Discord integrations in Hermes Agent use outbound HTTPS and WebSocket connections from your VPS to the platform APIs. You only need port 22 (SSH) open in UFW for your own server administration.</p>

</div>
</div>
</div>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://blog.aveshost.com/install-hermes-agent-on-an-ubuntu-vps/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Migrate a Linux VPS to a New Ubuntu Server Step-by-Step</title>
		<link>https://blog.aveshost.com/migrate-linux-vps-to-new-ubuntu-server/</link>
					<comments>https://blog.aveshost.com/migrate-linux-vps-to-new-ubuntu-server/#respond</comments>
		
		<dc:creator><![CDATA[James Wilson]]></dc:creator>
		<pubDate>Sat, 07 Nov 2026 20:03:20 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Hosting]]></category>
		<category><![CDATA[Linux VPS]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[Server Migration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[web hosting]]></category>
		<guid isPermaLink="false">https://blog.aveshost.com/?p=5810</guid>

					<description><![CDATA[Moving from an aging Linux VPS or switching distributions? Follow this step-by-step guide to migrate your web files, Docker containers, MySQL/PostgreSQL databases, and SSL certificates to a fresh Ubuntu LTS server with near-zero downtime.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Learning how to <strong>migrate a Linux VPS to a new Ubuntu server</strong> is the cleanest way to upgrade from an end-of-life operating system, move off a slow provider, or consolidate workloads onto faster resources without carrying over years of configuration cruft.</p>



<p class="wp-block-paragraph">Instead of cloning a full raw disk image—which copies outdated kernels, broken package dependencies, and filesystem fragmentation—the gold-standard production approach combines <strong>service-level provisioning</strong> on a fresh Ubuntu LTS instance with <strong>two-stage <a href="https://download.samba.org/pub/rsync/rsync.1" target="_blank" rel="noopener noreferrer">rsync</a> file synchronization</strong> and <strong>transactional database dumps</strong>.</p>



<p class="wp-block-paragraph"><strong>Key Takeaways:</strong> Lower your domain&#8217;s DNS TTL to <code>300</code> seconds (5 minutes) at least 24 hours before migration, provision and harden your target Ubuntu LTS server on <a href="https://www.aveshost.com/self-managed-vps-hosting" rel="noopener">Aveshost Self-Managed Linux VPS Hosting</a> (or <a href="https://www.aveshost.com/fully-managed-vps-hosting" rel="noopener">Aveshost Fully Managed VPS</a>), run an initial <code>rsync -avzP</code> pass while your live site stays online, perform a brief maintenance-mode database dump and delta sync, verify the new server via your local <code>/etc/hosts</code> file, and then switch your DNS <code>A</code> and <code>AAAA</code> records.</p>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><div><div><a href="#choose-the-right-linux-vps-migration-method">Choose the Right Linux VPS Migration Strategy</a></div><div><a href="#step-1-audit-source-vps-and-lower-dns-ttl">Step 1: Audit Your Source Linux VPS and Lower DNS TTL</a></div><div><a href="#step-2-provision-and-harden-new-ubuntu-server">Step 2: Provision and Harden Your New Ubuntu Server</a></div><div><a href="#step-3-sync-web-files-and-configs-with-rsync">Step 3: Run the Initial File Sync with Rsync Over SSH</a></div><div><a href="#step-4-migrate-databases-and-run-final-delta-sync">Step 4: Migrate MySQL/PostgreSQL Databases and Run the Final Delta Sync</a></div><div><a href="#step-5-test-new-ubuntu-server-before-dns-cutover">Step 5: Test Your New Ubuntu Server Using Your Local Hosts File</a></div><div><a href="#step-6-switch-dns-records-and-decommission-old-vps">Step 6: Switch DNS Records and Safely Decommission the Old VPS</a></div><div><a href="#faq">Frequently asked questions</a></div></div></nav></div>



<h2 id="choose-the-right-linux-vps-migration-method" class="wp-block-heading">Choose the Right Linux VPS Migration Strategy</h2>



<p class="wp-block-paragraph">Before running your first terminal command, choose the migration method that matches how your current Linux VPS is managed and whether you are changing distributions (such as moving from CentOS, AlmaLinux, or Debian to Ubuntu 24.04 LTS).</p>



<p class="wp-block-paragraph">For most production websites, Node.js/Python apps, and Docker stacks, <strong>Selective Rsync + Database Dump</strong> is the safest choice because it installs fresh, native Ubuntu packages on the destination server and copies only your application code, user data, and verified service configurations.</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Migration Method</th><th>Primary Tools</th><th>Expected Downtime</th><th>Best Use Case</th></tr></thead><tbody><tr><td>Selective Rsync + Database Dump (Recommended)</td><td>rsync over SSH, mysqldump / pg_dump</td><td>1 to 3 minutes (during final delta sync)</td><td>Upgrading to a clean Ubuntu LTS release or moving from Debian/AlmaLinux/CentOS</td></tr><tr><td>Control Panel Account Transfer</td><td>DirectAdmin Admin Backup or cPanel Transfer Tool</td><td>Under 5 minutes</td><td>Managed VPS servers running DirectAdmin or cPanel with mailboxes and domains</td></tr><tr><td>Docker Volume &amp; Compose Migration</td><td>rsync + docker compose + database dump</td><td>1 to 5 minutes</td><td>Containerized apps (such as self-hosted Supabase, n8n, or Next.js stacks)</td></tr><tr><td>Block-Level Disk Clone / Snapshot</td><td>Hypervisor snapshot or dd over SSH</td><td>15 to 60+ minutes (source must be stopped)</td><td>Identical hardware/OS lift-and-shift when you cannot reinstall software</td></tr></tbody></table></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1536" height="1024" src="https://blog.aveshost.com/wp-content/uploads/2026/11/vps-migration-methods-comparison.webp" alt="Three-column comparison diagram of Linux VPS migration methods: Rsync + Database Dump (Recommended), Control Panel Backup, and Full Disk Snapshot / Image" class="wp-image-5809" srcset="https://blog.aveshost.com/wp-content/uploads/2026/11/vps-migration-methods-comparison.webp 1536w, https://blog.aveshost.com/wp-content/uploads/2026/11/vps-migration-methods-comparison-300x200.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/11/vps-migration-methods-comparison-1024x683.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/11/vps-migration-methods-comparison-768x512.webp 768w" sizes="(max-width: 1536px) 100vw, 1536px" /></figure>



<h2 id="step-1-audit-source-vps-and-lower-dns-ttl" class="wp-block-heading">Step 1: Audit Your Source Linux VPS and Lower DNS TTL</h2>



<p class="wp-block-paragraph">The most common cause of post-migration outages is forgetting a background worker, a custom cron job, or a secondary Redis/PostgreSQL port running on the old VPS. Start by logging into your existing Linux VPS via SSH and running a full service and port inventory:</p>



<pre class="wp-block-code"><code># Check OS release, disk usage, and listening network ports on the old VPS:
cat /etc/os-release
df -h
sudo ss -tulnp

# List all active systemd services and scheduled cron jobs:
systemctl list-units --type=service --state=running
sudo crontab -l
ls -la /etc/cron* /etc/systemd/system/</code></pre>



<p class="wp-block-paragraph">Record the exact versions of your web server (Nginx, Apache, or Caddy), language runtimes (PHP-FPM, Node.js, Python), and database engines (MySQL, MariaDB, or PostgreSQL). Check <code>/etc/crontab</code>, <code>/etc/cron.d/</code>, and custom systemd units inside <code>/etc/systemd/system/</code> so you know every background job that must be recreated on the new Ubuntu server.</p>



<p class="wp-block-paragraph">Next, log in to your DNS provider and lower the <strong>TTL (Time to Live)</strong> on your domain&#8217;s <code>A</code>, <code>AAAA</code>, and mail records from the default <code>3600</code> or <code>14400</code> seconds down to <strong><code>300</code> seconds (5 minutes)</strong>. Doing this 24 hours ahead of time ensures that when you eventually update your IP address in Step 6, visitors worldwide switch to your new Ubuntu server within five minutes instead of waiting hours for stale DNS caches to expire.</p>



<h2 id="step-2-provision-and-harden-new-ubuntu-server" class="wp-block-heading">Step 2: Provision and Harden Your New Ubuntu Server</h2>



<p class="wp-block-paragraph">Deploy your new Ubuntu LTS instance (Ubuntu 24.04 LTS or 22.04 LTS) on an <a href="https://www.aveshost.com/self-managed-vps-hosting" rel="noopener">Aveshost Self-Managed VPS</a> with SSD storage, and connect to the new server via SSH as <code>root</code> or your sudo user.</p>



<p class="wp-block-paragraph">Update the package index, install matching versions of your web server, database engine, and runtime packages, and configure the <a href="https://ubuntu.com/server/docs/security-firewall" target="_blank" rel="noopener noreferrer">UFW firewall</a> before transferring any production data:</p>



<pre class="wp-block-code"><code># On the NEW Ubuntu LTS server: update packages, install stack &amp; enable UFW:
sudo apt update &amp;&amp; sudo apt full-upgrade -y
sudo apt install -y nginx certbot python3-certbot-nginx rsync ufw

sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable</code></pre>



<p class="wp-block-paragraph">Next, generate an Ed25519 SSH key pair on your <strong>old source VPS</strong> and copy its public key to your <strong>new Ubuntu server</strong> so the two servers can transfer files directly over an encrypted connection at data-center network speeds:</p>



<pre class="wp-block-code"><code># On the OLD source VPS: generate an Ed25519 SSH key and authorize it on the new Ubuntu server:
ssh-keygen -t ed25519 -C "vps-migration" -f ~/.ssh/id_migration -N ""
ssh-copy-id -i ~/.ssh/id_migration.pub -p 22 root@203.0.113.50</code></pre>



<h2 id="step-3-sync-web-files-and-configs-with-rsync" class="wp-block-heading">Step 3: Run the Initial File Sync with Rsync Over SSH</h2>



<p class="wp-block-paragraph">Never blindly copy the entire root filesystem (<code>/</code>) or overwrite system identity files such as <code>/etc/passwd</code>, <code>/etc/shadow</code>, <code>/etc/fstab</code>, or <code>/etc/netplan/</code> across different servers. Overwriting those files can corrupt boot loaders, break network interfaces, or lock you out of SSH.</p>



<p class="wp-block-paragraph">Instead, perform a <strong>live initial sync</strong> of your application directories (<code>/var/www/</code>, <code>/opt/</code>, <code>/home/</code>), web server virtual hosts (<code>/etc/nginx/sites-available/</code> or <code>/etc/apache2/sites-available/</code>), and Let&#8217;s Encrypt SSL certificates (<code>/etc/letsencrypt/</code>) while your old VPS remains online and serving traffic:</p>



<pre class="wp-block-code"><code># Run from the OLD VPS to sync web files, Nginx configs, and SSL certs to the NEW Ubuntu server:
rsync -avzP -e "ssh -i ~/.ssh/id_migration" /var/www/ root@203.0.113.50:/var/www/
rsync -avzP -e "ssh -i ~/.ssh/id_migration" /etc/nginx/sites-available/ root@203.0.113.50:/etc/nginx/sites-available/
rsync -avzP -e "ssh -i ~/.ssh/id_migration" /etc/letsencrypt/ root@203.0.113.50:/etc/letsencrypt/</code></pre>



<p class="wp-block-paragraph">Using the <code>-a</code> (archive) flag preserves file ownership, permissions, symbolic links, and timestamps, while <code>-z</code> compresses data in transit and <code>-P</code> shows live progress and allows interrupted transfers to resume. Because this initial pass copies 99% of your static media and code ahead of time, your final cutover sync in Step 4 will take only seconds.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1536" height="1024" src="https://blog.aveshost.com/wp-content/uploads/2026/11/linux-vps-to-ubuntu-migration-workflow.webp" alt="Four-step zero-downtime Linux VPS to Ubuntu migration workflow diagram: Audit &amp; Provision, Initial File Sync, Database &amp; Delta Sync, and Test &amp; DNS Cutover" class="wp-image-5808" srcset="https://blog.aveshost.com/wp-content/uploads/2026/11/linux-vps-to-ubuntu-migration-workflow.webp 1536w, https://blog.aveshost.com/wp-content/uploads/2026/11/linux-vps-to-ubuntu-migration-workflow-300x200.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/11/linux-vps-to-ubuntu-migration-workflow-1024x683.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/11/linux-vps-to-ubuntu-migration-workflow-768x512.webp 768w" sizes="(max-width: 1536px) 100vw, 1536px" /></figure>



<h2 id="step-4-migrate-databases-and-run-final-delta-sync" class="wp-block-heading">Step 4: Migrate MySQL/PostgreSQL Databases and Run the Final Delta Sync</h2>



<p class="wp-block-paragraph">Unlike static images or code files, relational databases cannot be copied safely by transferring raw <code>/var/lib/mysql</code> files while the database server is running. To prevent data loss or split-brain writes (where a customer submits an order on the old VPS after you already copied the database), follow this short cutover sequence:</p>



<p class="wp-block-paragraph"><strong>1. Put your web application into brief maintenance mode</strong> (or temporarily stop your queue workers) on the old VPS so no new database writes occur.</p>



<p class="wp-block-paragraph"><strong>2. Export a consistent database dump and stream or copy it to the new Ubuntu server:</strong> For MySQL or MariaDB, use <a href="https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html" target="_blank" rel="noopener noreferrer">mysqldump</a> with <code>--single-transaction</code>; for PostgreSQL (such as when you <a href="https://blog.aveshost.com/self-host-supabase-on-vps/">self-host Supabase on a VPS</a>), use <code>pg_dump</code>:</p>



<pre class="wp-block-code"><code># MySQL / MariaDB: consistent transactional dump and transfer to the new Ubuntu server:
mysqldump -u root -p --single-transaction --routines --triggers --events --all-databases | gzip &gt; all_dbs.sql.gz
scp -i ~/.ssh/id_migration all_dbs.sql.gz root@203.0.113.50:/root/
ssh -i ~/.ssh/id_migration root@203.0.113.50 "gunzip &lt; /root/all_dbs.sql.gz | mysql -u root"

# Final delta sync with --delete so recent file uploads match 100%:
rsync -avzP --delete -e "ssh -i ~/.ssh/id_migration" /var/www/ root@203.0.113.50:/var/www/</code></pre>



<p class="wp-block-paragraph"><strong>3. Run the final <code>rsync --delete</code> delta pass:</strong> Immediately after importing the database, run <code>rsync</code> one more time with the <code>--delete</code> flag on <code>/var/www/</code>. This transfers any user uploads created during the initial sync and removes any temporary files deleted on the old server, completing in just a few seconds.</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Directory or Data Type</th><th>Migrate Directly?</th><th>Recommended Command or Method</th></tr></thead><tbody><tr><td>/var/www/ &amp; /home/ (Web Roots &amp; User Files)</td><td>Yes</td><td>rsync -avzP &#8211;delete /var/www/ user@new-ubuntu-ip:/var/www/</td></tr><tr><td>/etc/letsencrypt/ (Certbot SSL Certificates)</td><td>Yes</td><td>rsync -avzP /etc/letsencrypt/ user@new-ubuntu-ip:/etc/letsencrypt/</td></tr><tr><td>/etc/nginx/ or /etc/apache2/ (Virtual Hosts)</td><td>Yes (Selectively)</td><td>Copy sites-available/ and test with nginx -t or apache2ctl configtest</td></tr><tr><td>MySQL / MariaDB / PostgreSQL Data</td><td>Dump &amp; Restore (Never raw /var/lib/)</td><td>mysqldump &#8211;single-transaction or pg_dump -Fc over SSH</td></tr><tr><td>/etc/fstab, /etc/netplan/, /etc/passwd, /boot/</td><td>Never Overwrite</td><td>Keep the new Ubuntu server&#8217;s native network, disk UUID, and kernel files</td></tr></tbody></table></figure>



<h2 id="step-5-test-new-ubuntu-server-before-dns-cutover" class="wp-block-heading">Step 5: Test Your New Ubuntu Server Using Your Local Hosts File</h2>



<p class="wp-block-paragraph">Never point your live domain&#8217;s DNS records at a new server before verifying that the web server, SSL certificates, and database connection work end to end. First, test your Nginx or Apache configuration syntax and restart your services on the new Ubuntu VPS:</p>



<p class="wp-block-paragraph">Next, test the live website using your domain name <em>without</em> changing public DNS by overriding the domain IP in the <code>hosts</code> file on your personal computer (<code>/etc/hosts</code> on macOS/Linux or <code>C:\Windows\System32\drivers\etc\hosts</code> on Windows) or by running <code>curl --resolve</code>:</p>



<pre class="wp-block-code"><code># On the NEW Ubuntu server: validate Nginx syntax and reload services:
sudo nginx -t &amp;&amp; sudo systemctl reload nginx

# From your local workstation: test HTTPS response from the new IP before changing DNS:
curl -I --resolve yourdomain.com:443:203.0.113.50 https://yourdomain.com</code></pre>



<p class="wp-block-paragraph">When you open <code>https://yourdomain.com</code> in your browser (or inspect the <code>curl --resolve</code> output), your computer connects directly to the new Ubuntu server while sending the real <code>Host: yourdomain.com</code> header and validating your SSL certificate. Test user login, database reads, and form submissions, then remove the temporary line from your local <code>hosts</code> file.</p>



<h2 id="step-6-switch-dns-records-and-decommission-old-vps" class="wp-block-heading">Step 6: Switch DNS Records and Safely Decommission the Old VPS</h2>



<p class="wp-block-paragraph">Once your verification checks pass, complete the cutover and post-migration cleanup:</p>



<p class="wp-block-paragraph"><strong>1. Update your DNS records:</strong> In your DNS provider&#8217;s dashboard, update your domain&#8217;s <code>A</code> record (IPv4) and <code>AAAA</code> record (IPv6) to point to the IP address of your new Ubuntu server. If you prefer a control-panel workflow for future static or React deployments, see our guide on <a href="https://blog.aveshost.com/deploy-lovable-website-to-directadmin/">deploying websites on DirectAdmin hosting</a> included with <a href="https://www.aveshost.com/fully-managed-vps-hosting" rel="noopener">Aveshost Fully Managed VPS plans</a>.</p>



<p class="wp-block-paragraph"><strong>2. Monitor live logs on both servers:</strong> Run <code>sudo tail -f /var/log/nginx/access.log</code> on both the old VPS and the new Ubuntu server. Because you lowered your TTL to <code>300</code> seconds in Step 1, you will see traffic shift onto the new Ubuntu server within a few minutes.</p>



<p class="wp-block-paragraph"><strong>3. Test Certbot auto-renewal and restore DNS TTL:</strong> Once DNS propagation is complete, run <code>sudo certbot renew --dry-run</code> on the new Ubuntu server to confirm Let&#8217;s Encrypt can validate your domain at its new IP, then raise your DNS TTL back to <code>3600</code> seconds.</p>



<p class="wp-block-paragraph"><strong>4. Keep the old VPS in read-only standby for 48–72 hours:</strong> Do not cancel or wipe your old Linux VPS immediately after switching DNS. Leave it stopped or firewalled for two to three days so you have an instant fallback if you discover a forgotten cron script or environment file, then create one final archive backup and decommission the old server.</p>



<h2 id="faq" class="wp-block-heading">Frequently asked questions</h2>


<div id="rank-math-faq" class="rank-math-block">
<div class="rank-math-list ">
<div id="faq-question-81fa5b65c3b14e9a86bedd266e8b6b96" class="rank-math-list-item">
<h3 class="rank-math-question ">Can I migrate a Linux VPS to a new Ubuntu server without downtime?</h3>
<div class="rank-math-answer ">

<p>Yes. By running an initial <code>rsync -avzP</code> pass while your old VPS stays live, lowering your DNS TTL to 300 seconds ahead of time, and performing a short maintenance-mode database dump plus a final <code>rsync --delete</code> delta pass, total write downtime is typically under two to three minutes.</p>

</div>
</div>
<div id="faq-question-6d4d4e6f03df4cfc92c02cc1e2325c65" class="rank-math-list-item">
<h3 class="rank-math-question ">Can I use rsync to migrate from CentOS, AlmaLinux, or Debian to Ubuntu?</h3>
<div class="rank-math-answer ">

<p>Yes, as long as you migrate only application files (<code>/var/www/</code>, <code>/home/</code>, <code>/opt/</code>), SSL certificates (<code>/etc/letsencrypt/</code>), and database dumps rather than system binaries or OS identity files. Install Nginx/Apache, PHP, Node.js, and MySQL/PostgreSQL natively on the new Ubuntu server using <code>apt</code>, then sync your site data and virtual host blocks.</p>

</div>
</div>
<div id="faq-question-2093b6d8df124fc7bb788303d668557f" class="rank-math-list-item">
<h3 class="rank-math-question ">Why shouldn&#x27;t I copy /var/lib/mysql directly with rsync?</h3>
<div class="rank-math-answer ">

<p>Copying raw InnoDB tablespace files in <code>/var/lib/mysql</code> while MySQL or MariaDB is running produces corrupted tables because uncommitted transactions and buffer pool pages remain in memory. Always use <code>mysqldump --single-transaction</code> (or stop the database service completely on identical engine versions) to guarantee a clean, consistent database restore.</p>

</div>
</div>
<div id="faq-question-02ddf5099cf44c6ca5b3d616485038bf" class="rank-math-list-item">
<h3 class="rank-math-question ">How do I migrate Let&#x27;s Encrypt SSL certificates to a new Ubuntu server?</h3>
<div class="rank-math-answer ">

<p>Sync the entire <code>/etc/letsencrypt/</code> directory from your old VPS to the new Ubuntu server using <code>rsync -avzP</code> (which preserves the symbolic links inside <code>/etc/letsencrypt/live/</code> pointing to <code>../../archive/</code>). After switching your DNS records to the new server&#8217;s IP, run <code>sudo certbot renew --dry-run</code> to verify automatic renewal.</p>

</div>
</div>
<div id="faq-question-f28932eac48d4901a392f8e25f0e36a8" class="rank-math-list-item">
<h3 class="rank-math-question ">What is the easiest way to migrate a VPS if I use DirectAdmin or cPanel?</h3>
<div class="rank-math-answer ">

<p>If both servers run DirectAdmin (included with <a href="https://www.aveshost.com/fully-managed-vps-hosting" rel="noopener">Aveshost Fully Managed VPS Hosting</a>) or cPanel, use the built-in <strong>Admin Backup/Transfer</strong> tool. It automatically packages your website files, MySQL databases, DNS zones, cron jobs, and email accounts into a single archive and restores them over SSH or FTP on the new server.</p>

</div>
</div>
</div>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://blog.aveshost.com/migrate-linux-vps-to-new-ubuntu-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Antigravity Remote Mobile Setup Made Easy (Full Guide)</title>
		<link>https://blog.aveshost.com/antigravity-remote-mobile-setup/</link>
					<comments>https://blog.aveshost.com/antigravity-remote-mobile-setup/#respond</comments>
		
		<dc:creator><![CDATA[James Wilson]]></dc:creator>
		<pubDate>Sat, 07 Nov 2026 19:28:10 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[AI Insights]]></category>
		<category><![CDATA[AI agents]]></category>
		<category><![CDATA[Google Antigravity]]></category>
		<category><![CDATA[Linux VPS]]></category>
		<category><![CDATA[Remote Control]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">https://blog.aveshost.com/?p=5803</guid>

					<description><![CDATA[Want to monitor and control your Google Antigravity coding agents from your phone? Follow this step-by-step Antigravity remote mobile setup guide for the desktop app, CLI, and always-on Linux VPS.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Completing an <strong>Antigravity remote mobile setup</strong> lets you monitor long-running AI coding agents, inspect live code diffs, answer clarifying questions, and approve terminal commands directly from your iPhone or Android phone while your desktop workstation or Linux server does the heavy lifting.</p>



<p class="wp-block-paragraph">With Google Antigravity&#8217;s built-in <a href="https://antigravity.google/docs/remote-control" target="_blank" rel="noopener noreferrer">Remote Control</a> architecture, you do not need to configure router port forwarding, dynamic DNS, or complex SSH tunnels on your phone. Instead, your host machine establishes an outbound, Google-authenticated reverse tunnel that streams your active workspaces directly to the web dashboard at <code>antigravity.google.com</code>.</p>



<p class="wp-block-paragraph"><strong>Key Takeaways:</strong> Enable Remote Control inside the Antigravity App under <strong>Settings → Application → Enable Remote Control</strong> (or run <code>agy remote-control start</code> in the terminal), sign in to <code>antigravity.google.com</code> on your mobile browser with the same Google Account, and install the dashboard to your phone&#8217;s home screen as a Progressive Web App (PWA) so you receive instant push notifications whenever an agent finishes a task or pauses for permission.</p>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><div><div><a href="#how-antigravity-remote-mobile-access-works">How Google Antigravity Remote Mobile Access Works</a></div><div><a href="#prerequisites-for-remote-mobile-setup">Prerequisites Before You Start</a></div><div><a href="#step-1-enable-remote-control-desktop-app">Step 1: Enable Remote Control in the Antigravity Desktop App</a></div><div><a href="#step-2-connect-phone-and-install-pwa">Step 2: Connect Your Phone and Install the Mobile Web App (PWA)</a></div><div><a href="#step-3-setup-cli-interactive-and-headless-daemon">Step 3: Set Up Antigravity CLI Remote Control (Interactive &amp; Headless Daemon)</a></div><div><a href="#run-always-on-antigravity-host-on-vps">Pro Tip: Run an Always-On Antigravity Mobile Host on a Linux VPS</a></div><div><a href="#troubleshooting-antigravity-remote-mobile-issues">Troubleshooting Common Antigravity Mobile Connection Issues</a></div><div><a href="#faq">Frequently asked questions</a></div></div></nav></div>



<h2 id="how-antigravity-remote-mobile-access-works" class="wp-block-heading">How Google Antigravity Remote Mobile Access Works</h2>



<p class="wp-block-paragraph">As AI development agents take on multi-file refactors, end-to-end test suites, and dependency migrations, a single task can run for ten to thirty minutes. If you are already using Antigravity as your primary agent-first platform (see our comparison of <a href="https://blog.aveshost.com/google-antigravity-vs-cursor/">Google Antigravity vs Cursor</a>), stepping away from your desk used to mean leaving an agent stalled at a command-approval prompt until you returned.</p>



<p class="wp-block-paragraph">Antigravity solves this by providing two distinct remote architectures: <strong>Remote Control</strong> (which connects your mobile browser directly to your own desktop workstation, laptop, or VPS) and <strong>Remote Agents</strong> (which runs tasks inside an isolated, Google-managed cloud virtual machine). Understanding the difference between these modes ensures you pick the right setup for your project.</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Feature</th><th>Desktop App Remote Control</th><th>CLI Headless Daemon (agy remote-control)</th><th>Cloud Remote Agents (agy &#8211;remote-agent)</th></tr></thead><tbody><tr><td>Where Code &amp; Tools Execute</td><td>Your local PC or Mac desktop app</td><td>Your local workstation or Linux VPS</td><td>Isolated Google-managed cloud VM</td></tr><tr><td>Host Power Requirement</td><td>Desktop must stay awake and online</td><td>Host machine or VPS must stay powered on</td><td>None (runs even if your laptop is off)</td></tr><tr><td>Access to Local Files &amp; Dev Servers</td><td>Full access to local folders, Docker, and MCP</td><td>Full access to local filesystem and Git worktrees</td><td>Cloud resources only (GitHub repos &amp; Drive files)</td></tr><tr><td>Survives Terminal Closure / Reboot</td><td>Runs while Antigravity App is open/backgrounded</td><td>Yes (starts automatically as an OS service)</td><td>Yes (persists in Google Cloud workspace)</td></tr><tr><td>Best Mobile Use Case</td><td>Monitoring active desktop UI projects on the go</td><td>24/7 mobile access to a workstation or Linux VPS</td><td>Quick GitHub repo tasks without a running host</td></tr></tbody></table></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1536" height="1024" src="https://blog.aveshost.com/wp-content/uploads/2026/11/antigravity-remote-mobile-architecture-workflow.webp" alt="Four-step Antigravity remote mobile setup workflow diagram: Enable Host Remote, Encrypted Tunnel, Open Mobile Web PWA, and Monitor &amp; Approve" class="wp-image-5801" srcset="https://blog.aveshost.com/wp-content/uploads/2026/11/antigravity-remote-mobile-architecture-workflow.webp 1536w, https://blog.aveshost.com/wp-content/uploads/2026/11/antigravity-remote-mobile-architecture-workflow-300x200.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/11/antigravity-remote-mobile-architecture-workflow-1024x683.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/11/antigravity-remote-mobile-architecture-workflow-768x512.webp 768w" sizes="(max-width: 1536px) 100vw, 1536px" /></figure>



<h2 id="prerequisites-for-remote-mobile-setup" class="wp-block-heading">Prerequisites Before You Start</h2>



<p class="wp-block-paragraph">Before pairing your smartphone with your coding environment, verify these four quick requirements so your connection registers cleanly on the first try:</p>



<p class="wp-block-paragraph"><strong>1. Up-to-date Google Antigravity App or CLI:</strong> Install the latest version of the Antigravity desktop application or update the command-line tool by running <code>agy update</code> in your terminal.</p>



<p class="wp-block-paragraph"><strong>2. A single shared Google Account:</strong> Remote Control authenticates sessions using zero-config Google Account identity rather than manual IP addresses or static passwords. You must sign in with the exact same Google Account on both your host machine and your mobile browser.</p>



<p class="wp-block-paragraph"><strong>3. Active host power settings:</strong> If you are hosting sessions from a Windows PC or MacBook rather than an always-on <a href="https://www.aveshost.com/self-managed-vps-hosting" rel="noopener">Linux VPS</a>, enable <strong>Keep computer awake</strong> and <strong>Run in background</strong> inside your Antigravity App settings so your operating system does not suspend network sockets when the screen dims.</p>



<p class="wp-block-paragraph"><strong>4. Modern mobile browser (Safari or Chrome):</strong> Use Safari on iOS/iPadOS or Google Chrome on Android so you can install the Remote Control dashboard to your home screen with full Web Push notification support.</p>



<h2 id="step-1-enable-remote-control-desktop-app" class="wp-block-heading">Step 1: Enable Remote Control in the Antigravity Desktop App</h2>



<p class="wp-block-paragraph">If you primarily work inside the graphical Antigravity 2.0 desktop application, turning on mobile access takes less than a minute from the built-in Settings panel:</p>



<p class="wp-block-paragraph"><strong>1. Open Application Settings:</strong> Launch the Antigravity App on your computer and press <code>Ctrl + ,</code> on Windows/Linux or <code>Cmd + ,</code> on macOS (or click <strong>Settings</strong> at the bottom of the left-hand sidebar).</p>



<p class="wp-block-paragraph"><strong>2. Toggle Enable Remote Control:</strong> Navigate to the <strong>Application</strong> section and switch <strong>Enable Remote Control</strong> to <strong>On</strong>.</p>



<p class="wp-block-paragraph"><strong>3. Set a recognizable Device Name:</strong> In the <strong>Device Name</strong> field right below the toggle, enter a clear identifier such as <code>workstation-primary</code>, <code>macbook-pro</code>, or <code>aveshost-vps</code>. When you open the mobile instance switcher on your phone, this name makes it effortless to distinguish your machines.</p>



<p class="wp-block-paragraph"><strong>4. Enable background wake locks:</strong> While in the Application settings panel, confirm that <strong>Keep computer awake</strong> and <strong>Run in background</strong> are enabled. This prevents your workstation from dropping its outbound connection while an agent is mid-way through a long build or browser test.</p>



<h2 id="step-2-connect-phone-and-install-pwa" class="wp-block-heading">Step 2: Connect Your Phone and Install the Mobile Web App (PWA)</h2>



<p class="wp-block-paragraph">Once Remote Control is toggled on, your workstation immediately registers with the Antigravity Remote Control Dashboard. You do not need to install a third-party wrapper from an app store; instead, Antigravity delivers a native-feeling mobile interface and push alerts through its official Progressive Web App (PWA):</p>



<p class="wp-block-paragraph"><strong>1. Open the Remote Control Dashboard on your phone:</strong> Open Safari (iPhone) or Chrome (Android) and navigate to <code>https://antigravity.google.com</code>.</p>



<p class="wp-block-paragraph"><strong>2. Sign in and select your host machine:</strong> Log in with the same Google Account used on your desktop. Tap the <strong>Instance Switcher</strong> in the top navigation bar and select the Device Name you configured in Step 1 (for example, <code>workstation-primary</code>).</p>



<p class="wp-block-paragraph"><strong>3. Install the app to your mobile home screen:</strong> On <strong>iPhone (Safari)</strong>, tap the <strong>Share</strong> icon at the bottom of the browser, scroll down, tap <strong>Add to Home Screen</strong>, and tap <strong>Add</strong>. On <strong>Android (Chrome)</strong>, tap the three-dot menu in the top-right corner and select <strong>Install app</strong> (or <strong>Add to Home screen</strong>).</p>



<p class="wp-block-paragraph"><strong>4. Allow push notifications:</strong> Launch the newly added Antigravity icon directly from your phone&#8217;s home screen and grant notification permissions when prompted. Now, whenever an agent completes a task, hits a test failure, or requests tool approval, your phone receives an actionable push alert.</p>



<h2 id="step-3-setup-cli-interactive-and-headless-daemon" class="wp-block-heading">Step 3: Set Up Antigravity CLI Remote Control (Interactive &amp; Headless Daemon)</h2>



<p class="wp-block-paragraph">If you prefer working in the terminal with the Antigravity CLI (<code>agy</code>) or running agents on a remote Linux server, the CLI offers two flexible ways to connect your phone: <strong>Interactive Mode</strong> for single terminal sessions and the <strong>Headless Background Daemon</strong> for 24/7 machine access.</p>



<p class="wp-block-paragraph"><strong>Option A — Interactive Session Handoff (<code>/remote-control</code>):</strong> When you are already mid-conversation inside an <code>agy</code> terminal session and need to step away from your desk, type <code>/remote-control</code> directly into the prompt box (or launch a new session with <code>agy --remote-control</code>). The CLI immediately opens a reverse tunnel and prints a direct mobile handoff link:</p>



<pre class="wp-block-code"><code># Inside an active agy terminal session, enable Remote Control:
/remote-control

# Output:
Remote control on for this session. Hostname: devbox-swift-falcon
Open https://antigravity.google.com/r/&lt;instance-id&gt;?p=c%2F&lt;conversation-id&gt; on another device to continue this conversation.

#Or launch a brand-new CLI session with Remote Control active:
agy --remote-control

# Disconnect the remote tunnel when finished:
/remote-control off</code></pre>



<p class="wp-block-paragraph">Opening that link on your phone drops you straight into the live conversation with real-time bidirectional sync—every prompt or tool confirmation (<code>y</code>/<code>n</code>) you tap on your phone streams live into your terminal, and closing the terminal (or typing <code>/remote-control off</code>) cleanly closes the tunnel.</p>



<p class="wp-block-paragraph"><strong>Option B — Always-On Headless Background Daemon (<code>agy remote-control start</code>):</strong> If you want your workstation or server to stay reachable from your phone at all times without leaving a terminal window open, register the native background service:</p>



<pre class="wp-block-code"><code># Register and start the always-on headless background daemon:
agy remote-control start --name "workstation-primary"

# Verify that the daemon is running and check its instance name:
agy remote-control status

# Stop and unregister the background daemon if needed:
agy remote-control stop</code></pre>



<p class="wp-block-paragraph">When you run <code>agy remote-control start</code>, Antigravity registers an operating-system service—a <code>systemd</code> user service on Linux, a <code>LaunchAgent</code> on macOS, or a Scheduled Task on Windows—that automatically restarts after crashes and reboots. On Windows, open PowerShell as <strong>Administrator</strong> before running <code>agy remote-control start</code> if you want the daemon to start automatically at system boot before any user logs in.</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Aspect</th><th>Interactive CLI (/remote-control)</th><th>Headless Daemon (agy remote-control start)</th></tr></thead><tbody><tr><td>Session Scope</td><td>Single open terminal window</td><td>Entire machine (background OS service)</td></tr><tr><td>Lifecycle</td><td>Disconnects as soon as the terminal closes</td><td>Persists across logouts and system reboots</td></tr><tr><td>Machine Naming</td><td>Auto-generated per session (e.g., devbox-swift-falcon)</td><td>Custom persistent name via &#8211;name flag or config.json</td></tr><tr><td>Concurrent Sessions</td><td>Multiple terminal tabs can run simultaneously</td><td>One persistent daemon service per machine</td></tr><tr><td>Mobile Entry Point</td><td>Direct conversation URL or instance switcher</td><td>Instance switcher on antigravity.google.com</td></tr></tbody></table></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1536" height="1024" src="https://blog.aveshost.com/wp-content/uploads/2026/11/antigravity-remote-modes-comparison.webp" alt="Three-column comparison diagram of Antigravity remote mobile modes: Interactive CLI Mode (/remote-control), Headless Daemon Mode (agy remote-control start), and Cloud Remote Agents (agy --remote-agent)" class="wp-image-5802" srcset="https://blog.aveshost.com/wp-content/uploads/2026/11/antigravity-remote-modes-comparison.webp 1536w, https://blog.aveshost.com/wp-content/uploads/2026/11/antigravity-remote-modes-comparison-300x200.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/11/antigravity-remote-modes-comparison-1024x683.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/11/antigravity-remote-modes-comparison-768x512.webp 768w" sizes="(max-width: 1536px) 100vw, 1536px" /></figure>



<h2 id="run-always-on-antigravity-host-on-vps" class="wp-block-heading">Pro Tip: Run an Always-On Antigravity Mobile Host on a Linux VPS</h2>



<p class="wp-block-paragraph">The biggest practical limitation of running Remote Control on a laptop is physical power: the moment you close your laptop lid on a commute or your home internet drops, your mobile dashboard loses contact with the host machine.</p>



<p class="wp-block-paragraph">You can eliminate that dependency completely by installing the Antigravity CLI and its headless daemon on an <a href="https://www.aveshost.com/self-managed-vps-hosting" rel="noopener">Aveshost Self-Managed Linux VPS</a>. Because a cloud VPS runs 24/7 on enterprise power and high-speed networking, registering <code>agy remote-control start --name "aveshost-cloud-dev"</code> turns your VPS into a permanent, pocket-accessible AI engineering workstation.</p>



<p class="wp-block-paragraph">Even better, unlike cloud-only sandboxes that reset after every task, an Antigravity daemon on your own VPS retains your persistent Docker containers, local staging databases, custom <a href="https://blog.aveshost.com/what-is-model-context-protocol-mcp/">Model Context Protocol (MCP) servers</a>, and SSH deploy keys—allowing you to review code, run tests, and deploy production fixes straight from your smartphone anywhere in the world.</p>



<h2 id="troubleshooting-antigravity-remote-mobile-issues" class="wp-block-heading">Troubleshooting Common Antigravity Mobile Connection Issues</h2>



<p class="wp-block-paragraph">If your host machine does not appear in your mobile browser or disconnects unexpectedly, run through these targeted fixes from the official <a href="https://antigravity.google/docs/remote-control#cli-troubleshooting" target="_blank" rel="noopener noreferrer">Antigravity troubleshooting documentation</a>:</p>



<p class="wp-block-paragraph"><strong>1. Machine does not appear in the mobile Instance Switcher:</strong> Verify that your host computer is awake, connected to the internet, and signed in to the exact same Google Account as your phone. For headless CLI setups, run <code>agy remote-control status</code> on the host; if it reports an authentication expiry, run <code>agy</code> interactively once to refresh your sign-in, then run <code>agy remote-control start</code>.</p>



<p class="wp-block-paragraph"><strong>2. Two similar machine names appear in the dashboard:</strong> This is normal when you enable Remote Control in both the Antigravity App editor and the CLI headless daemon on the same computer. They use separate keys in <code>~/.gemini/config/config.json</code> (<code>remoteControlHostname</code> for the desktop editor and <code>cliRemoteControlHostname</code> for the CLI daemon). Rename one of them using <code>agy remote-control start --name "my-cli-daemon"</code> to tell them apart.</p>



<p class="wp-block-paragraph"><strong>3. Interactive session disappears when you switch apps:</strong> Interactive tunnels started with <code>/remote-control</code> or <code>agy --remote-control</code> terminate immediately when the terminal process exits (<code>/exit</code> or <code>Ctrl + C</code>). Switch to <code>agy remote-control start</code> if you want the machine to stay online when no terminal window is open.</p>



<p class="wp-block-paragraph"><strong>4. Inspecting background daemon logs:</strong> If a headless service fails to connect, check the daemon log for your operating system to pinpoint network or account policy blocks:</p>



<pre class="wp-block-code"><code># Linux (systemd user service logs):
journalctl --user -u antigravity-cli-daemon -n 50

# macOS (LaunchAgent log file):
cat ~/Library/Logs/antigravity-cli-daemon.log

# Windows (PowerShell - view newest CLI daemon log):
Get-ChildItem "$env:USERPROFILE\.gemini\antigravity-cli\log\cli-*.log" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 | Get-Content -Tail 50</code></pre>



<h2 id="faq" class="wp-block-heading">Frequently asked questions</h2>


<div id="rank-math-faq" class="rank-math-block">
<div class="rank-math-list ">
<div id="faq-question-c58f443d84ee4caab0fa6804dafa700e" class="rank-math-list-item">
<h3 class="rank-math-question ">Is there an official Google Antigravity mobile app on the App Store or Google Play?</h3>
<div class="rank-math-answer ">

<p>Google Antigravity uses an official Progressive Web App (PWA) at <code>antigravity.google.com</code> rather than a separate native app store download. By opening <code>antigravity.google.com</code> in Safari (iOS) or Chrome (Android) and selecting <strong>Add to Home Screen</strong> or <strong>Install app</strong>, you get a standalone full-screen mobile app with native push notifications.</p>

</div>
</div>
<div id="faq-question-e640a8c04d1b4c079b88c2190a43a1e3" class="rank-math-list-item">
<h3 class="rank-math-question ">Does my computer need to stay turned on for Antigravity Remote Control to work?</h3>
<div class="rank-math-answer ">

<p>Yes. Because Antigravity Remote Control executes code, terminal commands, and local dev servers directly on your host machine, your computer (or Linux VPS) must remain powered on, awake, and connected to the internet. If you need agents to run while your laptop is turned off and you do not have a VPS, use <strong>Remote Agents</strong> (<code>agy --remote-agent</code>) on an eligible Google AI Pro or Ultra plan.</p>

</div>
</div>
<div id="faq-question-459157d6c7844b7fbc5454c81de510a3" class="rank-math-list-item">
<h3 class="rank-math-question ">Do I need to open firewall ports or set up port forwarding on my router?</h3>
<div class="rank-math-answer ">

<p>No. Both the Antigravity App and the <code>agy</code> CLI establish an outbound encrypted reverse tunnel to Google&#8217;s relay infrastructure authenticated by your Google Account. You never have to expose inbound ports on your home router or VPS firewall.</p>

</div>
</div>
<div id="faq-question-f9289a34440b49548dfd522995d6dcf0" class="rank-math-list-item">
<h3 class="rank-math-question ">How do I approve terminal commands and review code diffs from my phone?</h3>
<div class="rank-math-answer ">

<p>When an agent pauses for a tool execution confirmation or finishes an implementation plan, it sends a push notification to your mobile PWA. Tapping the alert opens the live conversation thread where you can inspect syntax-highlighted file diffs, answer multiple-choice questions, or tap <strong>Approve</strong> / <strong>Reject</strong> in real time.</p>

</div>
</div>
<div id="faq-question-71c89b5e18f340e4839866fc9e62c664" class="rank-math-list-item">
<h3 class="rank-math-question ">What is the difference between /remote-control and agy remote-control start?</h3>
<div class="rank-math-answer ">

<p>Typing <code>/remote-control</code> inside an active CLI session opens a temporary tunnel for that single terminal window and closes as soon as you exit the CLI. Running <code>agy remote-control start</code> installs a persistent background OS daemon that starts automatically at login or boot and keeps your machine accessible from your phone 24/7.</p>

</div>
</div>
</div>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://blog.aveshost.com/antigravity-remote-mobile-setup/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Automate WhatsApp Orders for Your Business Using a Cheap Linux VPS</title>
		<link>https://blog.aveshost.com/automate-whatsapp-orders/</link>
					<comments>https://blog.aveshost.com/automate-whatsapp-orders/#respond</comments>
		
		<dc:creator><![CDATA[James Wilson]]></dc:creator>
		<pubDate>Tue, 13 Oct 2026 15:25:28 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Hosting]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[e-commerce]]></category>
		<category><![CDATA[Linux VPS]]></category>
		<category><![CDATA[n8n]]></category>
		<category><![CDATA[WhatsApp automation]]></category>
		<guid isPermaLink="false">https://blog.aveshost.com/?p=5059</guid>

					<description><![CDATA[You can automate WhatsApp orders for your business using a cheap Linux VPS and spend less time sending the same updates manually. Connect your order system to send timely confirmations, secure payment links, verified receipts and delivery notifications. In this guide, we use n8n to build the automation engine on our self-managed Linux VPS, then [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph"><strong>You can automate WhatsApp orders for your business using a cheap Linux VPS</strong> and spend less time sending the same updates manually. Connect your order system to send timely confirmations, secure payment links, verified receipts and delivery notifications.</p>



<p class="wp-block-paragraph">In this guide, we use n8n to build the automation engine on our self-managed Linux VPS, then connect it to your shop, payment gateway and the official WhatsApp Business Platform. Follow the Docker setup and eight practical steps to create a system you can maintain as your business grows.</p>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><div><div><a href="#overview">What can you automate with WhatsApp and a Linux VPS?</a></div><div><a href="#tools">Choose your WhatsApp connection: Cloud API, Evolution API or Baileys</a></div><div><a href="#budget">Choose an affordable VPS and budget for the complete system</a></div><div><a href="#prepare">Step 1: prepare your server, domain and business accounts</a></div><div><a href="#docker">Step 2: deploy n8n and PostgreSQL with Docker Compose</a></div><div><a href="#https">Step 3: put n8n behind Nginx and HTTPS</a></div><div><a href="#connect">Step 4: connect the official WhatsApp Business Platform</a></div><div><a href="#orders">Step 5: build the order confirmation and payment-link workflow</a></div><div><a href="#receipts">Step 6: verify payment before sending a receipt</a></div><div><a href="#rules">Step 7: handle consent, templates and human support</a></div><div><a href="#reliability">Step 8: test, back up and monitor your automation</a></div><div><a href="#troubleshoot">Common WhatsApp automation problems and how to fix them</a></div><div><a href="#next">Build your WhatsApp order system on our cloud VPS</a></div><div><a href="#faq">Frequently asked questions</a></div></div></nav></div>



<h2 id="overview" class="wp-block-heading">What can you automate with WhatsApp and a Linux VPS?</h2>



<p class="wp-block-paragraph">To <strong>automate WhatsApp orders</strong>, connect your order system to a workflow engine, then use a messaging API to send the right update to the right customer. Your Linux VPS runs n8n; the shop maintains order records; the payment gateway confirms money received; WhatsApp delivers the messages.</p>



<p class="wp-block-paragraph">Start with three useful automations: order acknowledgement, a secure payment link for an unpaid order, and a receipt after verified payment. Add delivery updates once those are working. This approach suits online shops, service businesses and developers building integrations for clients.</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Event</th><th>Automated action</th><th>What must be checked</th></tr></thead><tbody><tr><td>New order</td><td>Confirm items and order number</td><td>Valid customer number and messaging permission</td></tr><tr><td>Unpaid order</td><td>Send its payment link</td><td>Correct amount, currency and secure checkout URL</td></tr><tr><td>Verified payment</td><td>Send receipt or receipt link</td><td>Gateway status matches the stored order</td></tr><tr><td>Dispatch recorded</td><td>Send delivery update</td><td>Actual dispatch and tracking details</td></tr><tr><td>Customer asks for help</td><td>Route to a person</td><td>Human handover and response hours</td></tr></tbody></table></figure>



<p class="wp-block-paragraph">Automation should reduce repeated typing while keeping your records accurate. A payment link does not mean an order has been paid, and an API accepting a message does not mean the customer has received it. Track those events separately.</p>



<h2 id="tools" class="wp-block-heading">Choose your WhatsApp connection: Cloud API, Evolution API or Baileys</h2>



<p class="wp-block-paragraph">We recommend <strong>n8n with the official WhatsApp Cloud API</strong> for business order notifications. n8n provides the workflow editor and integration nodes. The Cloud API provides the supported messaging connection. You self-host the automation engine, while Meta operates the messaging service.</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Tool</th><th>Role</th><th>Best use</th></tr></thead><tbody><tr><td>n8n Community edition</td><td>Connects triggers, conditions and APIs</td><td>Your own business automation on a VPS</td></tr><tr><td>WhatsApp Cloud API</td><td>Official business messaging API</td><td>Production order confirmations and receipts</td></tr><tr><td>Evolution API</td><td>REST integration layer with multiple connection types</td><td>Developers who need its additional integration features</td></tr><tr><td>Baileys</td><td>Library connecting to WhatsApp Web</td><td>Experimental projects with carefully assessed operational risk</td></tr></tbody></table></figure>



<p class="wp-block-paragraph"><a href="https://github.com/evolution-foundation/evolution-api" rel="noopener">Evolution API</a> supports both Cloud API and Baileys-based connections. Choosing Evolution API does not by itself tell you which connection is being used. Check the configured adapter, its maintenance requirements and its licence before deployment.</p>



<p class="wp-block-paragraph"><a href="https://github.com/WhiskeySockets/Baileys" rel="noopener">Baileys</a> is an unofficial WhatsApp Web library, not a Meta-approved business API. Web-session changes, disconnections and account enforcement can interrupt an integration. Do not make your only business order channel depend on a linked-device session or assume an unofficial connection gives permission for bulk messaging.</p>



<p class="wp-block-paragraph">n8n is fair-code software rather than unrestricted open-source software. Its Community edition can serve your internal business workflows; commercial hosting, embedding and customer access have licence conditions. Review the <a href="https://support.n8n.io/article/can-i-use-your-license-for-my-use-case" rel="noopener">n8n licensing guidance</a> before selling access to an automation service.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1536" height="1024" src="https://blog.aveshost.com/wp-content/uploads/2026/10/whatsapp-automation-stack.webp" alt="Online shop connected to n8n on a Linux VPS, WhatsApp Cloud API and payment gateway" class="wp-image-5062" srcset="https://blog.aveshost.com/wp-content/uploads/2026/10/whatsapp-automation-stack.webp 1536w, https://blog.aveshost.com/wp-content/uploads/2026/10/whatsapp-automation-stack-300x200.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/10/whatsapp-automation-stack-1024x683.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/10/whatsapp-automation-stack-768x512.webp 768w" sizes="(max-width: 1536px) 100vw, 1536px" /><figcaption class="wp-element-caption">Your VPS runs the workflow engine; messaging and payment services connect through their APIs.</figcaption></figure>



<h2 id="budget" class="wp-block-heading">Choose an affordable VPS and budget for the complete system</h2>



<p class="wp-block-paragraph">Our <a href="https://www.aveshost.com/self-managed-vps-hosting" rel="noopener">self-managed cloud VPS plans</a> give you root access to install Docker, n8n and your supporting services. You manage the operating system and application stack. A hosting control panel is not required for this tutorial.</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Plan</th><th>Advertised monthly USD price</th><th>Resources</th><th>Suggested role</th></tr></thead><tbody><tr><td>Cloud VPS 1</td><td>$9.13</td><td>1 vCore, 2 GB RAM, 20 GB SSD</td><td>Small proof of concept with light workloads</td></tr><tr><td>Cloud VPS 2</td><td>$15.51</td><td>4 vCores, 8 GB RAM, 100 GB SSD</td><td>Our practical starting choice for n8n and PostgreSQL</td></tr><tr><td>Cloud VPS 3</td><td>$27.38</td><td>6 vCores, 12 GB RAM, 200 GB SSD</td><td>More headroom for additional services or larger workflows</td></tr></tbody></table></figure>



<p class="wp-block-paragraph">Prices and product information were reviewed <strong>at the time of writing</strong>. Confirm the billing term, selected options and final checkout amount on our plans page. Our self-managed VPS plans come with SSD storage.</p>



<p class="wp-block-paragraph">An approximately $10–$20 monthly VPS budget can cover a small automation server. It does not include every operating cost. Allow for your domain, backups, WhatsApp template-message charges where applicable, payment-processing fees and your time maintaining the system. Optional AI calls or a shared support inbox add their own costs.</p>



<p class="wp-block-paragraph">Meta uses <a href="https://whatsappbusiness.com/products/platform-pricing/" rel="noopener">message-category and recipient-market pricing</a>, with free service messaging and applicable exceptions for some utility messages. Build a budget from your expected delivered messages and current rate card. Self-hosting n8n gives you control of execution capacity; it does not remove WhatsApp policies, API rate limits or finite server resources.</p>



<h2 id="prepare" class="wp-block-heading">Step 1: prepare your server, domain and business accounts</h2>



<ul class="wp-block-list">
<li>Choose Ubuntu 24.04 LTS and a VPS with enough memory for n8n, PostgreSQL and a reverse proxy.</li>



<li>Point an A record such as <code>automation.example.com</code> to the server IPv4 address. Add an AAAA record only if IPv6 is configured correctly.</li>



<li>Use a sudo-enabled administrator account with SSH keys. Keep a working SSH session while changing firewall rules.</li>



<li>Prepare a Meta developer account, business portfolio, WhatsApp-enabled app and a business phone number eligible for your onboarding route.</li>



<li>Prepare your shop or order API, a payment gateway merchant account, a privacy notice and a way to record messaging permission.</li>
</ul>



<p class="wp-block-paragraph">Install Docker Engine and the Compose plugin using the <a href="https://docs.docker.com/engine/install/ubuntu/" rel="noopener">official Ubuntu installation instructions</a>. Then check the installation and install the web proxy tools:</p>



<pre class="wp-block-code"><code>sudo docker version
sudo docker compose version
sudo apt update
sudo apt install -y nginx certbot python3-certbot-nginx openssl
mkdir -p ~/whatsapp-automation
cd ~/whatsapp-automation</code></pre>



<p class="wp-block-paragraph">Allow your actual SSH port and HTTP/HTTPS through the host and provider firewall. This setup needs public ports 80 and 443. Keep n8n port 5678 bound to localhost and PostgreSQL private; neither needs a public firewall opening. If you already host sites on the server, preserve their proxy configuration.</p>



<h2 id="docker" class="wp-block-heading">Step 2: deploy n8n and PostgreSQL with Docker Compose</h2>



<p class="wp-block-paragraph">This is a fresh, single-instance deployment without an AI sandbox or extra messaging bridge. Create a <code>.env</code> file in your project directory. Replace every placeholder before starting. Set <code>N8N_VERSION</code> to a specific stable version from the <a href="https://github.com/n8n-io/n8n/releases" rel="noopener">official releases</a>, and review its deployment requirements.</p>



<pre class="wp-block-code"><code>N8N_VERSION=REPLACE_WITH_STABLE_VERSION
N8N_HOST=automation.example.com
GENERIC_TIMEZONE=Etc/UTC
POSTGRES_PASSWORD=REPLACE_WITH_RANDOM_SECRET
N8N_ENCRYPTION_KEY=REPLACE_WITH_ANOTHER_RANDOM_SECRET</code></pre>



<p class="wp-block-paragraph">Run <code>openssl rand -hex 32</code> twice to generate separate secrets. Save the encryption key securely: restoring database records without the matching key can leave your stored credentials unreadable. Protect the file with <code>chmod 600 .env</code> and keep it out of source control.</p>



<p class="wp-block-paragraph">Create <code>compose.yml</code>:</p>



<pre class="wp-block-code"><code>services:
  postgres:
    image: postgres:16
    restart: unless-stopped
    environment:
      POSTGRES_DB: n8n
      POSTGRES_USER: n8n
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: &#91;"CMD-SHELL", "pg_isready -U n8n -d n8n"]
      interval: 10s
      timeout: 5s
      retries: 10
  n8n:
    image: docker.n8n.io/n8nio/n8n:${N8N_VERSION}
    restart: unless-stopped
    ports:
      - "127.0.0.1:5678:5678"
    environment:
      DB_TYPE: postgresdb
      DB_POSTGRESDB_HOST: postgres
      DB_POSTGRESDB_PORT: 5432
      DB_POSTGRESDB_DATABASE: n8n
      DB_POSTGRESDB_USER: n8n
      DB_POSTGRESDB_PASSWORD: ${POSTGRES_PASSWORD}
      N8N_HOST: ${N8N_HOST}
      N8N_PORT: 5678
      N8N_PROTOCOL: https
      N8N_EDITOR_BASE_URL: https://${N8N_HOST}/
      N8N_WEBHOOK_URL: https://${N8N_HOST}/
      N8N_PROXY_HOPS: 1
      N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
      N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: "true"
      GENERIC_TIMEZONE: ${GENERIC_TIMEZONE}
      TZ: ${GENERIC_TIMEZONE}
      EXECUTIONS_DATA_PRUNE: "true"
      EXECUTIONS_DATA_MAX_AGE: 168
    volumes:
      - n8n_data:/home/node/.n8n
    depends_on:
      postgres:
        condition: service_healthy
volumes:
  postgres_data:
  n8n_data:</code></pre>



<p class="wp-block-paragraph">The current reverse-proxy guidance uses <code>N8N_WEBHOOK_URL</code>; older n8n versions used <code>WEBHOOK_URL</code>. Use the variable supported by your pinned release. The proxy-hop value of 1 assumes requests reach n8n through only the Nginx proxy in the next step. See the <a href="https://docs.n8n.io/hosting/configuration/configuration-examples/webhook-url/" rel="noopener">webhook URL configuration guide</a>.</p>



<pre class="wp-block-code"><code>sudo docker compose config --quiet
sudo docker compose up -d
sudo docker compose ps
sudo docker compose logs --tail=50 n8n
curl -fsS http://127.0.0.1:5678/healthz</code></pre>



<p class="wp-block-paragraph">Use the <a href="https://docs.n8n.io/hosting/installation/docker/" rel="noopener">n8n Docker documentation</a> for release-specific options. A successful health response shows the service is reachable locally; the next step makes it reachable securely through your domain.</p>



<h2 id="https" class="wp-block-heading">Step 3: put n8n behind Nginx and HTTPS</h2>



<p class="wp-block-paragraph">Create <code>/etc/nginx/sites-available/automation</code> with the configuration below, replacing the example domain. The upgrade header supports the editor’s live connection; forwarded headers tell n8n the original request used HTTPS.</p>



<pre class="wp-block-code"><code>server {
    listen 80;
    server_name automation.example.com;
    location / {
        proxy_pass http://127.0.0.1:5678;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 300s;
    }
}</code></pre>



<p class="wp-block-paragraph">Enable the site, validate Nginx and request the certificate. These commands assume the site file has not already been enabled:</p>



<pre class="wp-block-code"><code>sudo ln -s /etc/nginx/sites-available/automation /etc/nginx/sites-enabled/automation
sudo nginx -t
sudo systemctl reload nginx
sudo certbot --nginx -d automation.example.com
sudo certbot renew --dry-run</code></pre>



<p class="wp-block-paragraph">Choose the HTTPS redirect when prompted. Open your HTTPS domain immediately and finish the n8n owner-account setup before advertising the endpoint. Use a strong password and available two-factor authentication. Confirm that webhook URLs show your domain and HTTPS, without port 5678.</p>



<p class="wp-block-paragraph">If you later add another proxy, update trusted proxy settings to match the real request path. Avoid blanket authentication or bot challenges on webhook endpoints, because Meta and your payment gateway must reach them. Secure those endpoints with their documented signatures or credentials instead.</p>



<h2 id="connect" class="wp-block-heading">Step 4: connect the official WhatsApp Business Platform</h2>



<p class="wp-block-paragraph">In Meta’s app dashboard, open WhatsApp API Setup and begin with the test sender and an allowed test recipient. In n8n, create WhatsApp Business Cloud credentials using the access token and WhatsApp Business Account ID. The sender is selected using its phone-number ID, which is different from the business account ID.</p>



<p class="wp-block-paragraph">Add a <strong>WhatsApp Business Cloud</strong> node, select the credential and sender, then send a test message to the permitted recipient. Its Send and Send Template operations cover normal replies and approved templates. Follow the <a href="https://docs.n8n.io/integrations/builtin/credentials/whatsapp/" rel="noopener">credential setup</a> and <a href="https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.whatsapp/" rel="noopener">node documentation</a> for the fields in your version.</p>



<p class="wp-block-paragraph">For incoming customer messages, use the <strong>WhatsApp Trigger</strong> with its separate OAuth2 credential and Messages event. Authenticate using the Meta App ID and App Secret. Publish the workflow when testing is complete. n8n’s <a href="https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.whatsapptrigger/" rel="noopener">trigger guide</a> explains that switching test and production webhooks can replace the callback registered for the app; use a separate test app for development alongside live orders.</p>



<p class="wp-block-paragraph">Before going live, complete the onboarding requirements for your business, number and app. Replace a temporary test token with an appropriate production credential, document expiry or rotation, and test approved templates. Existing-number migration or coexistence depends on the onboarding route; do not assume QR pairing or simply copying a phone number activates Cloud API.</p>



<style>
.aveshost-whatsapp-banner{box-sizing:border-box;display:flex;flex-wrap:wrap;align-items:center;gap:22px;padding:20px;margin:30px 0;border-radius:18px;background:linear-gradient(125deg,#071e49 0%,#075bc4 65%,#087c73 100%);box-shadow:0 12px 28px rgba(8,40,86,.16);color:#fff;font-family:inherit;overflow:hidden}
.aveshost-whatsapp-banner *{box-sizing:border-box}
.aveshost-whatsapp-banner .apb-copy{flex:1 1 320px;min-width:0}
.aveshost-whatsapp-banner .apb-logo{display:block;width:110px;height:auto;margin:0 0 10px}
.aveshost-whatsapp-banner .apb-title{color:#fff;font-size:clamp(22px,2.3vw,25px);font-weight:750;line-height:1.18;margin:0 0 12px;letter-spacing:-.5px}
.aveshost-whatsapp-banner .apb-description{color:#e5efff;font-size:15px;line-height:1.5;margin:0 0 16px}
.aveshost-whatsapp-banner .apb-button{display:inline-block;background:#a5f3c6;color:#063c39!important;font-size:16px;font-weight:700;line-height:1.4;text-decoration:none!important;padding:11px 18px;border-radius:8px;border:2px solid transparent}
.aveshost-whatsapp-banner .apb-button:hover{background:#d1fae5}
.aveshost-whatsapp-banner .apb-button:focus-visible{outline:3px solid #fff;outline-offset:4px}
.aveshost-whatsapp-banner .apb-art{flex:1 1 200px;min-width:0;max-width:240px;margin:auto;position:relative;padding:12px 25px 26px 0}
.aveshost-whatsapp-banner .apb-window{background:#f5f9ff;border:1px solid #b8d6ff;border-radius:12px;box-shadow:0 15px 35px rgba(0,15,55,.25);overflow:hidden}
.aveshost-whatsapp-banner .apb-window-top{padding:10px 12px;background:#dceaff;color:#075bc4;font-size:12px;letter-spacing:4px}
.aveshost-whatsapp-banner .apb-window-body{padding:16px;color:#0a2858}
.aveshost-whatsapp-banner .apb-window-label{font-size:10px;font-weight:750;text-transform:uppercase;letter-spacing:1px;color:#477096;margin-bottom:8px}
.aveshost-whatsapp-banner .apb-window-title{font-size:22px;line-height:1.15;font-weight:750;margin-bottom:16px}
.aveshost-whatsapp-banner .apb-bar{height:7px;background:#dce8f6;border-radius:4px;margin:9px 0;width:90%}
.aveshost-whatsapp-banner .apb-mini-button{margin-top:18px;display:inline-block;background:#0b6be4;color:#fff;padding:9px 14px;border-radius:6px;font-size:12px;font-weight:700}
.aveshost-whatsapp-banner .apb-phone{position:absolute;right:0;bottom:0;width:86px;padding:7px;background:#0b234b;border:2px solid #6d9cdd;border-radius:16px;box-shadow:0 8px 20px rgba(0,20,55,.25)}
.aveshost-whatsapp-banner .apb-phone-screen{background:#eef6ff;border-radius:9px;padding:15px 7px 12px;min-height:120px;color:#0a2858;text-align:center;font-size:10px;font-weight:700}
.aveshost-whatsapp-banner .apb-phone-icon{display:block;background:#cff6e5;color:#08735c;border-radius:50%;width:34px;height:34px;line-height:34px;font-size:20px;margin:5px auto 12px}
@media(max-width:480px){.aveshost-whatsapp-banner{padding:22px;gap:18px}.aveshost-whatsapp-banner .apb-copy{flex-basis:100%}.aveshost-whatsapp-banner .apb-art{display:none}.aveshost-whatsapp-banner .apb-button{width:100%;text-align:center}}
</style>
<aside class="aveshost-whatsapp-banner" aria-label="WhatsApp order automation and payment integration by Aveshost">
<div class="apb-copy">
<img decoding="async" class="apb-logo" src="https://www.aveshost.com/assets/images/logo_w.png" alt="Aveshost" width="145" loading="lazy">
<p class="apb-title">Ready to automate your WhatsApp orders?</p>
<p class="apb-description">Need WhatsApp order automation or payment integration for your business? Let’s discuss your project and connect your orders, payments and customer updates.</p>
<a class="apb-button" href="https://www.aveshost.com/support" rel="noopener">Discuss Your Project <span aria-hidden="true">→</span></a>
</div>
<div class="apb-art" aria-hidden="true">
<div class="apb-window"><div class="apb-window-top">● ● ●</div><div class="apb-window-body"><div class="apb-window-label">Your orders. Connected.</div><div class="apb-window-title">Confirm.<br>Pay. Deliver.</div><div class="apb-bar"></div><div class="apb-bar" style="width:65%"></div><div class="apb-mini-button">Order confirmed</div></div></div>
<div class="apb-phone"><div class="apb-phone-screen"><span class="apb-phone-icon">✓</span>Payment<br>verified<div class="apb-bar" style="width:85%;margin:12px auto 0"></div></div></div>
</div>
</aside>



<h2 id="orders" class="wp-block-heading">Step 5: build the order confirmation and payment-link workflow</h2>



<p class="wp-block-paragraph">For a first rollout, trigger messages from your shop’s structured order record. Taking free-text chat orders requires another layer to collect product, quantity, delivery address and explicit confirmation. Keep the shop database as the source of truth for prices and stock.</p>



<p class="wp-block-paragraph">Create a workflow with this sequence: <strong>authenticated order event → retrieve order → check permission → deduplicate → choose message → send → record result</strong>. Your backend can call an n8n Webhook node with Header Auth. Use a random shared secret stored server-side, never in browser JavaScript. If your shop sends signed webhooks instead, validate the signature using its documented method before processing.</p>



<ul class="wp-block-list">
<li>Receive an order ID and event ID. Retrieve the actual order through an authenticated shop API rather than trusting prices or URLs supplied by the event sender.</li>



<li>Normalise the recipient number to the format required by the WhatsApp node. Store the customer’s country code explicitly; do not guess it from the server location.</li>



<li>Check the recorded messaging permission, opt-out flag, current order status and whether this message has already been sent.</li>



<li>For an unpaid order, obtain its secure payment URL from the shop or gateway. Include the order number, total, currency and a clear next action.</li>



<li>Use Send Template for an approved order-related template when required. Match each placeholder to the approved template’s order and language.</li>



<li>Save the provider message ID and sending outcome against the order. Process later delivery-status events separately.</li>
</ul>



<p class="wp-block-paragraph">Example order acknowledgement: <em>“Thanks, {{customer_name}}. We received order {{order_number}} for {{items}}. Your total is {{total}} {{currency}}. Complete payment at {{payment_url}}. Reply if you need help.”</em> This is draft copy to adapt and submit where template approval is required, not a pre-approved template.</p>



<p class="wp-block-paragraph">A payment link should lead to your genuine HTTPS checkout or the gateway’s hosted checkout. Do not ask customers to send card details, PINs or one-time passwords in chat. Sending a reminder should not silently recreate the order or add another charge.</p>



<p class="wp-block-paragraph">Keep message selection deterministic at first. A simple If node checking status is easier to audit than an AI agent deciding whether money was received. Your bot can hand off uncertain requests to a person.</p>



<h2 id="receipts" class="wp-block-heading">Step 6: verify payment before sending a receipt</h2>



<p class="wp-block-paragraph">Build a separate paid-order workflow. The trigger must be a trusted paid-order event or an authenticated gateway notification, not the customer opening a link or sending a screenshot. Recheck the transaction against the stored order before changing its status.</p>



<ul class="wp-block-list">
<li>Validate the gateway webhook signature against the original request body, before processing the event.</li>



<li>Retrieve or verify the transaction server-side with the gateway credential. Require the final successful status.</li>



<li>Compare the transaction reference, amount, currency and merchant/order association with your records.</li>



<li>Apply the payment update atomically and reject an already-processed transaction.</li>



<li>Create the receipt or retrieve it from your store, then send the appropriate WhatsApp update.</li>
</ul>



<p class="wp-block-paragraph">For example, <a href="https://paystack.com/docs/payments/webhooks/" rel="noopener">Paystack signs webhook payloads</a> using the <code>x-paystack-signature</code> header and HMAC-SHA512. Its <a href="https://paystack.com/docs/payments/verify-payments/" rel="noopener">transaction verification endpoint</a> returns a final transaction status. Use the equivalent documented checks for your chosen gateway. A generic Header Auth secret is not a substitute for validating a gateway’s own signature.</p>



<p class="wp-block-paragraph">For pay-on-delivery orders, send an acknowledgement that says payment is due on delivery. Send the paid receipt after the collection is recorded. For refunds or cancellations, use a separate approved update reflecting the actual final status.</p>



<p class="wp-block-paragraph">Example receipt message: <em>“Payment received for order {{order_number}}. Amount: {{total}} {{currency}}. Receipt: {{receipt_url}}. We will send your dispatch update when the order is ready.”</em> Receipt URLs should not expose another customer’s documents; use access controls or suitably scoped expiring links.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1536" height="1024" src="https://blog.aveshost.com/wp-content/uploads/2026/10/whatsapp-order-messages.webp" alt="Order received, payment verified and delivery updates sent through WhatsApp automation" class="wp-image-5063" srcset="https://blog.aveshost.com/wp-content/uploads/2026/10/whatsapp-order-messages.webp 1536w, https://blog.aveshost.com/wp-content/uploads/2026/10/whatsapp-order-messages-300x200.webp 300w, https://blog.aveshost.com/wp-content/uploads/2026/10/whatsapp-order-messages-1024x683.webp 1024w, https://blog.aveshost.com/wp-content/uploads/2026/10/whatsapp-order-messages-768x512.webp 768w" sizes="(max-width: 1536px) 100vw, 1536px" /><figcaption class="wp-element-caption">Keep order acknowledgement, verified payment and dispatch updates as separate events.</figcaption></figure>



<h2 id="rules" class="wp-block-heading">Step 7: handle consent, templates and human support</h2>



<p class="wp-block-paragraph">Follow the <a href="https://whatsappbusiness.com/policy/" rel="noopener">WhatsApp Business Messaging Policy</a>. Record the permission needed to contact customers and respect opt-outs. Make the checkout wording clear about order updates, and keep promotional subscriptions separate from transactional messages.</p>



<p class="wp-block-paragraph">A customer message opens a 24-hour service window, reset by each new customer message. Within the open window, permitted free-form replies can be used. Outside it, use approved message templates. A website checkout alone does not open that messaging window. Keep order templates factual: adding discounts or unrelated offers can affect their category.</p>



<p class="wp-block-paragraph">Give customers an easy way to stop messages and reach a person. Route “help”, disputed payments, address changes, refunds and unrecognised requests to a support queue. If your automation captures chat orders, ask customers to confirm the final items and total before creating the order. Never let a language model invent stock availability, delivery promises or refund decisions.</p>



<h2 id="reliability" class="wp-block-heading">Step 8: test, back up and monitor your automation</h2>



<p class="wp-block-paragraph">Test with your own numbers and test-mode payments before contacting customers. Include unsuccessful outcomes as well as the happy path:</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Test</th><th>Expected result</th></tr></thead><tbody><tr><td>Order created twice or webhook replayed</td><td>One acknowledgement for the same order event</td></tr><tr><td>Payment pending, failed or wrong amount</td><td>No paid receipt and no automatic fulfilment</td></tr><tr><td>Payment succeeds after the customer closes checkout</td><td>Verified payment updates the correct order</td></tr><tr><td>Customer opts out</td><td>Further optional WhatsApp messages stop</td></tr><tr><td>Token expires or template is rejected</td><td>Alert and human fallback</td></tr><tr><td>VPS restarts</td><td>Persistent records survive; pending work is recoverable</td></tr><tr><td>Message accepted but delivery fails</td><td>Delivery status is recorded separately</td></tr></tbody></table></figure>



<p class="wp-block-paragraph">Use durable event and message records with unique keys such as order ID plus event type. An If node followed by a send is not enough to prevent duplicates when executions overlap. Use a database uniqueness constraint or a transactional outbox so only one worker claims the notification. After an ambiguous API timeout, reconcile the result before blindly resending.</p>



<p class="wp-block-paragraph">Retry transient failures with bounded backoff and alert on persistent failures. Do not repeatedly retry an invalid recipient, rejected template or withdrawn permission. Keep email or human contact available if a WhatsApp update cannot be delivered.</p>



<p class="wp-block-paragraph">Back up PostgreSQL, the n8n data volume and the encryption key. Store an encrypted copy away from the running instance and test a restore. Restrict execution-history retention, redact secrets and avoid retaining complete customer chats unnecessarily. This Compose example prunes executions older than 168 hours; adjust retention to your business needs.</p>



<p class="wp-block-paragraph">Pin versions, review release notes and back up before upgrades. After changing the version in <code>.env</code>, use <code>sudo docker compose pull</code> and <code>sudo docker compose up -d</code>, then repeat the webhook and payment tests. Do not use <code>docker compose down -v</code> during routine updates because it removes the named data volumes.</p>



<p class="wp-block-paragraph">Watch memory, CPU, disk space, database growth and failed executions. Upgrade your <a href="https://www.aveshost.com/self-managed-vps-hosting" rel="noopener">cloud VPS resources</a> when measured workload requires it. High concurrency may justify dedicated workers and a queue architecture rather than simply increasing the number of parallel workflows.</p>



<h2 id="troubleshoot" class="wp-block-heading">Common WhatsApp automation problems and how to fix them</h2>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Problem</th><th>Check first</th></tr></thead><tbody><tr><td>Incoming events never arrive</td><td>Public HTTPS, correct callback URL, published workflow and firewall reachability</td></tr><tr><td>n8n shows localhost webhook URLs</td><td>Public webhook variable and reverse-proxy headers for the pinned release</td></tr><tr><td>Editor loses its live connection</td><td>Nginx upgrade headers and proxy timeouts</td></tr><tr><td>Outbound message rejected</td><td>Token, sender ID, recipient, template language and service window</td></tr><tr><td>Paid receipt sent twice</td><td>Unique event keys, concurrent executions and retry reconciliation</td></tr><tr><td>Payment link shows the wrong total</td><td>Retrieve the authoritative order and create the link server-side</td></tr><tr><td>Server runs out of space</td><td>Execution pruning, logs, uploads and backup retention</td></tr></tbody></table></figure>



<p class="wp-block-paragraph">Solve connection and authentication problems before adding more workflow logic. Check the failed node’s error, the gateway event log and the corresponding order record. Logs should contain enough detail to diagnose the issue without exposing access tokens or complete customer data.</p>



<h2 id="next" class="wp-block-heading">Build your WhatsApp order system on our cloud VPS</h2>



<p class="wp-block-paragraph">The strongest first version is a small, predictable workflow: receive a real order, send a clear payment link, verify payment and send the receipt. Add chat-based ordering, delivery updates and richer support integrations once that foundation is working.</p>



<p class="wp-block-paragraph">Choose our <a href="https://www.aveshost.com/self-managed-vps-hosting" rel="noopener">self-managed Linux VPS hosting</a> for the root access and flexibility to run your Docker stack. Cloud VPS 2 offers a practical starting point for the n8n and PostgreSQL deployment in this guide. Select the location and resources that fit your business, then scale from measured usage.</p>



<p class="wp-block-paragraph">Need help connecting your website, order system or payment gateway? <a href="https://www.aveshost.com/support" rel="noopener">Discuss your project with us</a> so we can plan the integration around your customer journey.</p>



<h2 id="faq" class="wp-block-heading">Frequently asked questions</h2>


<div id="rank-math-faq" class="rank-math-block">
<div class="rank-math-list ">
<div id="faq-question-wa-0" class="rank-math-list-item">
<h3 class="rank-math-question ">Can I automate WhatsApp orders on a Linux VPS?</h3>
<div class="rank-math-answer ">

<p>Yes. Run n8n on the VPS, connect your order system and use a messaging API such as the official WhatsApp Cloud API. Your shop should remain the source of truth for prices, stock and payment status.</p>

</div>
</div>
<div id="faq-question-wa-1" class="rank-math-list-item">
<h3 class="rank-math-question ">Is a $10–$20 VPS enough for n8n?</h3>
<div class="rank-math-answer ">

<p>It can suit a small workload. At the time of writing, our Cloud VPS 2 is advertised at $15.51 per month with 4 vCores, 8 GB RAM and 100 GB SSD. Budget separately for messaging, payment processing, backups and maintenance.</p>

</div>
</div>
<div id="faq-question-wa-2" class="rank-math-list-item">
<h3 class="rank-math-question ">Does self-hosting make WhatsApp messages free?</h3>
<div class="rank-math-answer ">

<p>No. Hosting your workflow engine does not remove Meta’s messaging charges, policies or API limits. Costs depend on the category and recipient market, with applicable free messaging exceptions.</p>

</div>
</div>
<div id="faq-question-wa-3" class="rank-math-list-item">
<h3 class="rank-math-question ">Is n8n open source?</h3>
<div class="rank-math-answer ">

<p>n8n is fair-code software. Its free Community edition has Sustainable Use License conditions. Review the licence before offering customer access, embedding it or selling it as a hosted service.</p>

</div>
</div>
<div id="faq-question-wa-4" class="rank-math-list-item">
<h3 class="rank-math-question ">Should I use Evolution API or Baileys?</h3>
<div class="rank-math-answer ">

<p>Evolution API can use either an official Cloud API connection or an unofficial Baileys-based connection. Baileys relies on WhatsApp Web and is not Meta-approved. We recommend the official connection for business order notifications.</p>

</div>
</div>
<div id="faq-question-wa-5" class="rank-math-list-item">
<h3 class="rank-math-question ">Can I send payment links and receipts automatically?</h3>
<div class="rank-math-answer ">

<p>Yes. Obtain the correct checkout link from your shop or gateway. Send a paid receipt only after authenticated server-side verification matches the transaction to the order, amount and currency.</p>

</div>
</div>
<div id="faq-question-wa-6" class="rank-math-list-item">
<h3 class="rank-math-question ">Do customers need to message me first?</h3>
<div class="rank-math-answer ">

<p>A customer message opens the 24-hour service window for permitted free-form replies. Outside that window, use approved templates and the required messaging permission. Placing a website order alone does not open the window.</p>

</div>
</div>
<div id="faq-question-wa-7" class="rank-math-list-item">
<h3 class="rank-math-question ">Can this also collect orders directly in chat?</h3>
<div class="rank-math-answer ">

<p>Yes, with an additional flow for product selection, quantity, delivery details and customer confirmation. Retrieve prices and stock from your shop API and confirm the final summary before creating an order.</p>

</div>
</div>
<div id="faq-question-wa-8" class="rank-math-list-item">
<h3 class="rank-math-question ">Do I need cPanel for this setup?</h3>
<div class="rank-math-answer ">

<p>No. This tutorial uses SSH, Docker Compose and Nginx on a self-managed Linux VPS. You administer the operating system and application services directly.</p>

</div>
</div>
<div id="faq-question-wa-9" class="rank-math-list-item">
<h3 class="rank-math-question ">How do I prevent duplicate order messages?</h3>
<div class="rank-math-answer ">

<p>Store durable event identifiers and use database uniqueness or a transactional outbox to claim notifications. Reconcile ambiguous send failures before retrying, and keep payment processing idempotent.</p>

</div>
</div>
</div>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://blog.aveshost.com/automate-whatsapp-orders/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
