Basic deployment setup and process with NGINX
Authored_by: Basant Rai

Nowadays, as a software developer, knowing how to deploy your applications is just as important as writing code. It’s no longer an “ops-only” job deployment has become a basic skill every developer should learn.
I'll guide you step by step through the deployment process.
Step1: Setting up Nginx
Nginx is one of the most popular web servers in the world. It’s lightweight, fast, and commonly used as a reverse proxy to serve applications.
First Install Nginx
sudo apt update
sudo apt install nginx -y
Start and enable Nginx:
sudo systemctl start nginx
sudo systemctl enable nginx
Check status:
systemctl status nginx
Now, open your server IP in a browser:
You should see the default Nginx welcome page.
Configure Nginx for Your App
sudo nano /etc/nginx/conf.d/app.conf
And basic setup
server {
listen 80;
server_name myapp.com www.myapp.com; # Your App domain
location / {
proxy_pass http://localhost:3000; # your app runs on port 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;
}
}Enable config:
sudo ln -s /etc/nginx/conf.d/app.conf /etc/nginx/sites-enabled/Test and restart Nginx:
sudo nginx -t
# This command sholud give nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# And restart nginx
sudo systemctl restart nginx
Now your app is accessible through your domain or server IP address.
Final Step
Last but not least, once the site is accessible from the domain, it needs an SSL certificate. Otherwise, the site will be considered unsecured. To do that, just run this command:
sudo apt-get install certbot python3-certbot-nginx
sudo certbot --nginx -d your.domain.com