Serve Next.js from a VPS with Smooth CDN
Keep your Next.js app on a VPS, publish frontend assets to Smooth CDN, and use CDN URLs for static files in production.
The problem
A VPS can run your Next.js app, but it does not need to serve every static file for every visitor. JavaScript, CSS, fonts, and images are often requested much more often than the dynamic work your app actually performs.
Without a separate asset pipeline, the same VPS handles application requests and repeated static file delivery, even though those files are better suited for CDN caching.
Static files served by the VPS
More repeated load on the origin
Assets mixed with app deployment
No repeatable publish step
Harder CDN adoption
Solution
Keep Next.js running on your VPS, but move the static delivery layer to Smooth CDN. Build the app, publish generated frontend assets to CDN, and let the browser fetch those files from stable CDN URLs while the VPS stays focused on the application itself.
1
Install and setup Smooth CDN CLI
Smooth CDN CLI publishes the files generated by your Next.js build. You can run it locally first and later move the same flow into deployment automation.
npm install -g @smoothcdn/cliscdn login2
Define Next.js files to publish
Point Smooth CDN at the generated static files from your Next.js app and any public assets that should be served from CDN in production.
{
"project": "My Next.js Assets",
"projectSlug": "my-nextjs-assets",
"userSlug": "user",
"blockBots": false,
"blockHeadless": false,
"sources": [
"./.next/static/**/*.{js,css,woff,woff2}",
"./public/**/*.{png,jpg,svg,webp,ico}"
],
"replacePath": {
"/.next/": "/_next/",
"/public/": "/"
}
}3
Run deployment
Build the Next.js app, publish assets to Smooth CDN, and deploy the app itself to your VPS. The important part is that static files are published during the same release flow.
npm run build
scdn push
# deploy the Next.js app to your VPS
# restart Your app
scdn syncscdn sync command must be used once NextJS app is reload - it'll remove all outdated assets from previous builds.
4
Use CDN asset URLs in production
Configure your production frontend to load static files from Smooth CDN while the VPS continues to serve the Next.js application runtime.
import type {NextConfig} from "next";
const nextConfig: NextConfig = {
assetPrefix: "https://cdn.smoothcdn.com/user/my-nextjs-assets",
};
export default nextConfig;What You get
A cleaner split between your Next.js runtime and the files users load repeatedly in production.
Next.js stays on your VPS
JS, CSS, fonts, and images move to CDN URLs
Less repeated static-file work on the origin
One repeatable publish flow for each release
Cleaner separation between app hosting and asset delivery
Keep Next.js on your VPS. Move static delivery to Smooth CDN.
Use your VPS for the app runtime and Smooth CDN for the files that should be cached close to users.