All articles
Learn how to deploy and host your product on your VPS server on your own domain.
Here's the quickest way to get your Next.js 14 application running on an Ubuntu VPS:
1
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt install -y nodejs
2
git clone your-repository-url cd your-project-directory npm install
3
npm run build npm start
That's it! Your Next.js app should now be running on port 3000. You can access it at http://your-server-ip:3000
Note: To keep the app running after you close your terminal, you can use: nohup npm start &
Using Your Own Domain
To use your own domain with your Next.js app:
1
Go to your domain registrar (e.g., GoDaddy, Cloudflare, Namecheap) and add these records:
Type: A Record Name: @ (or your subdomain) Value: Your-VPS-IP-Address TTL: 3600 (or automatic)
2
sudo apt install nginx -y sudo systemctl start nginx
3
Ensure to change the yourdomain.com
to your own domain:
sudo nano /etc/nginx/sites-available/nextjs server { listen 80; server_name yourdomain.com www.yourdomain.com; location / { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }
4
sudo ln -s /etc/nginx/sites-available/nextjs /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl restart nginx
Your Next.js app should now be accessible at yourdomain.com
. DNS changes can take up to 48 hours to propagate, but usually only take a few minutes.
Thank you to ohwinterr
for contributing to this article
Talk to our community or create a ticket on our Discord server
More articles
Using Vercel to host your website? Here's a guide to help you get started.
Learn how to setup and self-host Ember - The complete freelancer panel. Ember uses Supabase in the backend, making it super easy to setup and host.
Learn how to link your Discord to your Buzz.dev account, so you can use it to respond to tickets via Discord.
Learn how to customize your website to your liking. This includes changing the settings, theming your website, and changing the design.