How do I run my nuxt app on a different URL and port using pm2?

I want to run my Nuxt app on a different URL and port using pm2 and the ecosystem.config.js.

I want it to run like the following package.json script:

"devhost": "nuxt --hostname 'my.url.domain' --port 8080"

This scipt allows me to run my nuxt app on my desired port and url. But if I follow the configuration given by the nuxt documentation [here][1], the app runs on localhost:3000 and with that I cant run the app on a different machine, making it problematic.

Unfortunately, I have searched the net and can’t seem to find a solution to my specific situation.

I tried changing the script option to script: "npm" and setting args like so: args: "devhost" but even this didn’t work.

Running pm2 logs says can't run command "nuxt-dev-host" and, therefore, it didn’t work.

I also tried to change script to ./node_modules/nuxt/bin/nuxt.js with the same args but it still didn’t work.

Please help.

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