By stupidboy
Hi I want to change the default port 3000 to 3001
according to nuxt doc we just need to add the port to .env file https://nuxt.com/docs/getting-started/deployment#configuring-defaults-at-runtime
I put those to my env but not working
#NITRO_PORT = "3001"
PORT = "3001"
how I build the nuxt 3
first I go to nuxt project directory
run npm run build
them pm2 start
after I check
netstat -plant | grep 3001
does not return anything
but netstat -plant | grep 3000
did has return
0
0
:::3000
:::*
LISTEN
711987/PM2 v5.2.2:
btw this is my ecosystem.config.js
module.exports = {
apps: [
{
name: 'nuxt-php-framework',
exec_mode: 'cluster',
instances: 'max',
script: './.output/server/index.mjs'
}
]
}
this is my package .json
{
"name": "nuxt-php-framework",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"axios": "^1.2.1",
"nuxt": "^3.0.0"
},
"devDependencies": {
"@nuxt/postcss8": "^1.1.3",
"autoprefixer": "^10.4.13",
"postcss": "^8.4.20",
"tailwindcss": "^3.2.4"
}
}
thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Hi @stupidboy,
Add the port in the module.export section and then start your application. Something like the following should do the trick
- module.exports = {
- apps: [
- {
- name: 'nuxt-php-framework',
- port: 3001,
- exec_mode: 'cluster',
- instances: 'max',
- script: './.output/server/index.mjs'
- }
- ]
- }
-
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.