
How We Self-Hosted ERPNext with Cloudflare Tunnel and Fixed Static Asset Issues

At Techsolvo, we recently set up a self-hosted ERPNext instance for a client who preferred not to use public cloud platforms. The goal was to keep the entire ERP system in a private, locally-hosted environment, while still allowing external access through a secure and stable tunnel.
This blog covers our full experience — the challenges, debugging, and final solution that made everything work seamlessly.
The Objective
-
Self-host ERPNext (latest version) on a local server.
-
Make it accessible over the internet using a custom domain (
erp.xyz.in
). -
Avoid exposing the local IP directly.
-
Use Cloudflare Tunnel to securely expose the service.
Key Setup Steps
-
ERPNext Installation
-
We set up ERPNext and HRMS on a fresh site.
-
Configured Nginx to serve multiple ports (80 and 8001).
-
Linked the custom domain via Cloudflare.
-
-
Cloudflare Tunnel Configuration
-
Created a named tunnel using:
cloudflared tunnel create erpnext-tunnel
-
Configured the tunnel to forward requests to localhost:8001.
-
Mapped the tunnel to our domain using a CNAME record to
cfargotunnel.com
.
-
-
Nginx Configuration
-
We ensured
public/assets
was symlinked properly to../../assets
. -
All static files (CSS, JS, images) were served through the
/assets
route.
-
-
Common Issue: CSS/JS Not Loading
-
After running
bench build
orbench migrate
, static assets sometimes failed to load unless the page was hard refreshed. -
This was due to Cloudflare or browser cache serving outdated or missing asset versions.
-
-
The Fixes
-
Purged Cloudflare cache after every build:
Cloudflare Dashboard → Caching → Purge Everything
-
Ensured correct symlinks:
ln -sfn ../../assets sites/erp.xyz.in/public/assets
-
Rebuilt assets cleanly:
bench build --force bench clear-cache bench restart
-
-
Automating the Tunnel
-
Ran the tunnel as a system service to ensure it starts on reboot:
cloudflared service install
-
Final Result
-
✅ ERPNext accessible securely via
https://erp.xyz.in
-
✅ No need to open ports to the public internet
-
✅ Static assets now load consistently across sessions
-
✅ System reboot-proof thanks to
cloudflared
service
Why This Matters
For clients who are strict about data privacy and on-premise infrastructure, this setup is ideal. You get all the features of ERPNext without compromising security or depending on a third-party cloud.
At Techsolvo, we believe in offering practical and efficient automation setups — even for complex, hybrid environments.
Need Help with a Similar Setup?
Whether you're looking to:
-
Set up ERPNext for manufacturing
-
Integrate eCommerce with ERP
-
Secure self-hosted apps with Cloudflare
📧 Reach out to us at mradul.mishra@techsolvo.com or visit techsolvo.com/contact-us
Let’s make your business processes smarter!
Insights
To properly understand the things that are prevalent in the industries, keeping up-to-date with the news is crucial. Take a look at some of our expertly created blogs, based on full-scale research and statistics on current market conditions.

Why Techsolvo is the Best ERPNext Implementation Partner in UAE
Discover why Techsolvo is recognized as the best ERPNext agency in the UAE. Trusted by ma…

How We Self-Hosted ERPNext with Cloudflare Tunnel and Fixed Static Asset Issues
Learn how Techsolvo successfully deployed a self-hosted ERPNext instance using Cloudflare…

Best ERPNext Implementation Company in UAE – Techsolvo’s Expert ERP Services
Looking for the best ERPNext implementation company in UAE? Techsolvo offers expert ERPNe…