I’m currently hosting my Next.js site on an external provider (not Vercel, for now) and need to upload my build files via SFTP.
Based on the Next.js documentation, I added the following configuration to generate static build files:
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: 'export'
/* config options here */
};
export default nextConfig;
After running next build, I successfully get an out
folder containing all my assets, including images and PDFs that were originally in my local public folder.
I uploaded all these files to my SFTP server, and everything works except for the images, which are not displaying at all.
I’m unsure if the issue is related to how images are handled in my application or if it’s a path-related problem. This is my first time building a Next.js project for deployment.
If more details or screenshots are needed, please let me know!
Thanks in advance for your help.
Environment:
• Next.js version: 15.2.3
• Node.js version: v20.18.0
• Hosting provider: Infomaniak
• Deployment method: SFTP
Steps to Reproduce:
-
Set output: ‘export’ in next.config.js.
-
Run next build to generate the static files.
-
Upload the out folder to the SFTP server.
-
Try to access the images on the deployed site.
Expected Behavior:
Images should be displayed correctly as they are in the out folder.
Actual Behavior:
Images are not showing on the site, while other assets (like PDFs) work fine.
Possible Causes / Additional Notes:
• Could it be an issue with next/image when using output: ‘export’?
• Do I need to adjust the paths for images when using static exports?
• Are there any specific settings required for serving static assets correctly from an SFTP-hosted site?
Any insights would be greatly appreciated!