Hosting nextjs/reactjs site to vps using virtualmin

Hello, I have been trying to search for solutions to host my nextjs site to vps using virtualmin and i am unable to find it. It would be great if i get help regarding this query.

I don’ have Nextjs sites but do have some ReactJS sites running.
First thing you need is a version of Node installed. (with NPM - or Yarn if you prefer)
Then install PM2 to manage it. (think of that as Nodemon for servers)
You will have to update Apache or Nginx to manage the webserver. (a reverse proxy for Nginx - I cannot help with Apache) I always use a sub dir of public_html build the app in that and load it from there.

BTW Welcome and actually Virtalmin has nothing to do with this - all done from console.

1 Like

Thank you very much for the reply. I will do this way. and one thing i have seen the nodejs as a service in pro version of virtualmin and wanted to know if they provide a gui based tool to host sites.

No idea on that one.
I’m afraid I see NodeJS as being nothing to do with Virtualmin partly because the choice of which version of Node is not relevant and different websites depend on different versions so a box may have different versions running so upgrading Node and NPM is almost a guarantee to break some code. So you can have more than one version running. Add to that the ever changing ReactJS and probably NextJS it seems unlikely that it will ever fall within the objective of Virtualmin.
I just install NodeJS from the command line

curl -o- | bash


nvm install 16.18.0

or whichever version you need.

Thank you very much ;).
I will be doing this way.

I suspect most people hosting nodejs on a Virtualmin system are not using it. It sort of takes an older approach to running nodejs apps that isn’t commonly used today (though it is still just proxying to it, which is how you want to use any app framework).

On the systems where I’ve setup nodejs, I’ve just followed the deployment instructions for the app, and proxied to it from whichever web server I am using. There is GUI support for adding proxy rules, or you can add them manually (though if you enable Virtualmin’s port protection feature you’ll have to be careful about which ports you use…don’t use any that Virtualmin sets up for its managed apps, or use named sockets instead of ports).

In short: Just do what your application documentation tells you to do. Virtualmin has very little to do with it.

We are planning containerized app support in Virtualmin 8, which is a common app packaging and deployment method in the nodejs world (and many other communities), so it will become a bit more automated in the future, at least for apps that have good container builds.

1 Like

If you are using Apache and you have a node server running on localhost and port 3000, you can use the basic Apache Proxy function in Virtualmin:

I would also recommend using PM2 - it will mean your node service can run as a background service.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.