For any React Native app developer expanding into full-stack and web solutions, deploying a Next.js app on AWS EC2 is a power move. This setup combines the flexibility of cloud infrastructure with the performance of server-side rendering, ideal for businesses needing scalable, cross-platform app development. Whether you’re managing custom business app solutions or an enterprise-grade product, learning to host Next.js on EC2 builds confidence in creating seamless digital ecosystems that connect your mobile app development with robust, production-ready web experiences.
Be sure to use the desired region.
Create an SSH key pair and upload it to AWS before generating an EC2 instance. Use this key when setting up your EC2.
Install and Configure Apache
sudo apt updatesudo apt install apache2sudo systemctl start apache2sudo systemctl enable apache2sudo a2enmod proxy_httpsudo systemctl restart apache2Modify files in /etc/apache2/sites-available accordingly and enable and restart, if necessary:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/<domain>.confsudo rm -R /var/www/htmlExample File:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName <domain>
ServerAlias <subdomain>.<domain>
DocumentRoot /var/www/<project>
...
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>sudo a2dissite 000-defaultsudo a2ensite <domain>sudo systemctl reload apache2Generate an SSL Certificate
Make sure to add the elastic IP address to the DNS records so the app resolves before completing the next steps.
sudo apt-get install certbot python3-certbot-apachesudo certbot --apacheInstall Node and NPM
sudo apt install nodejssudo apt install npmInstall PM2
sudo npm install pm2 -g Clone Project
ssh-keygenAdd your public key to GitLab through the Console.
sudo chown -R $USER /var/wwwgit clone [email protected]:<something>/<something>.gitgit fetchgit checkout <branch>git pullStart App
Add your variables with:
sudo nano .envInside the project run
npm installnpm run buildpm2 start npm --name <project> -- run start -- -p 3000Cloning your Project
Do not use sudo when cloning your project.
Make Changes
Pull, install, and:
pm2 restart <project>Deploying a Next.js app on AWS EC2 gives you a solid foundation for growth, from performance-driven websites to cross-platform apps that feel polished, fast, and dependable. For any React Native app developer, understanding how your web and mobile layers connect is what transforms good code into great user experiences. With custom app development and ongoing support in mind, this workflow keeps your projects secure, scalable, and ready to meet enterprise demands without losing the creative edge your users love.
If you’re ready to bring your Next.js, Expo, or React Native project to life, or need expert guidance deploying your app on AWS, let’s talk. As a React Native app developer and mobile software engineer, I help startups and organizations build, launch, and scale cross-platform apps that perform beautifully across iOS, Android, and the web. Reach out today!
Every project begins with a conversation—no pressure, no commitment. At Bessa Apps, I offer a free Discovery phase designed to uncover your goals, explore your vision, and pitch tailored solutions that fit. As a react native app developer, I believe the best partnerships start with listening, not selling. Whether you're dreaming up a sleek iOS and Android app or planning a custom web development project, this first step helps us identify the opportunities that matter most to your business and your customers.
Think of Discovery as your launchpad. It's where strategy meets possibility, giving you clarity and direction before any code is written. From refining your concept to mapping out features like in-app purchases, direct messaging, or authentication, I'll guide you through the options with transparency and expertise. The result will be a clear path forward, backed by app development services that balance innovation with practicality, so you can move toward launch with confidence.
© Copyright Bessa Community Apps, LLC