Hi, I have a requirement where I have to deploy a Next.js on IIS. It's my first time deploying to IIS. I've made a small test project to mess around with. I do have a couple results but nothing major.
I've followed some guides on medium that explain the process, like this one: https://medium.com/@dipneupane/deploying-nextjs-application-on-windows-iis-server-cabdc22bccf8
The steps I've taken already to deploy the test project:
- I 've created a plain test project creating a new Next.js project
- I've done a
next buildto create a build output. - I then created a separate build folder with the following files (it's not clear in the layout but the other files aren't nested within
.next:.nextnode_modulesweb.config(from the medium article)server.js(also from the medium article)
- After this I installed
iisnodeandURLRewriteas suggested in the guide. - I then created a new application in IIS under
Workstation > Sites > Default Web Site > iis-test-project - I set the physical path to the build folder that contains the perviously named folders and files.
- I gave the correct user all of the necessary permissions on the application and the AppPool.
- I refreshed everything and "browsed" the application, which added the iisnode folder.
- I then got a (next.js)
404 | Page not found.
After all of this I also tried adding output: "export" to the next.config.js. I repeated the same steps but then with out instead of .next. That also gave me a Build_ID error Error: ENOENT: no such file or directory, open 'C:\source\iis-test-project-build\.next\BUILD_ID'
However, when I pointed the path to the out file directly I did get to see the basic html but no css or anything.
Surely I'm missing some crucial steps but I feel like I'm quite close to making this work. I'd love any kind of input or direction.
Any idea? I wouldn't mind getting in a call with someone.
Thank you in advance.
NextJs is the server-side rendered React-based framework for creating Single page applications. It is most popular because of its…