This guide explains how to make an UpRecruit VPS deployment production-ready using Nginx as a reverse proxy, Let’s Encrypt SSL, and PM2 for process management.
Complete the basic UpRecruit VPS installation before following this guide.
Prerequisites
You should already have:
- UpRecruit installed on an Ubuntu or Debian VPS
- Node.js installed
- PostgreSQL configured
- PM2 running the UpRecruit frontend and backend
- A domain name pointed to the VPS IP address
- Nginx installed or ready to install
Step 1 — Install Nginx
Install Nginx:
sudo apt install -y nginx
Enable Nginx:
sudo systemctl enable nginx
sudo systemctl start nginx
Step 2 — Configure Nginx for UpRecruit
Create an Nginx configuration for UpRecruit:
sudo nano /etc/nginx/sites-available/uprecruit
Add:
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
location / {
proxy_pass http://localhost:3001;
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;
}
location /api/ {
proxy_pass http://localhost:5000;
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;
}
client_max_body_size 20M;
}
The / path routes traffic to the UpRecruit frontend, while /api/ routes requests to the Node.js backend.
Step 3 — Enable the UpRecruit Nginx Site
Create the symbolic link:
sudo ln -s /etc/nginx/sites-available/uprecruit /etc/nginx/sites-enabled/
Test the configuration:
sudo nginx -t
Reload Nginx:
sudo systemctl reload nginx
Step 4 — Enable HTTPS for UpRecruit
Install Certbot:
sudo apt install -y certbot python3-certbot-nginx
Request an SSL certificate:
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
Certbot will configure HTTPS and can redirect HTTP traffic to HTTPS.
Step 5 — Update the UpRecruit Backend URL
Open the backend .env file:
nano /var/www/uprecruit/backend/.env
Set:
CLIENT_URL=https://yourdomain.com
Save the file and restart the UpRecruit API:
pm2 restart uprecruit-api
Step 6 — Restrict Direct Application Ports
Once Nginx is handling web traffic, direct access to ports 3001 and 5000 is no longer required.
Remove the firewall rules:
sudo ufw delete allow 3001/tcp
sudo ufw delete allow 5000/tcp
Allow Nginx:
sudo ufw allow 'Nginx Full'
Check the firewall status:
sudo ufw status
Step 7 — Monitor UpRecruit Logs
View PM2 logs:
pm2 logs
View Nginx access logs:
sudo tail -f /var/log/nginx/access.log
View Nginx error logs:
sudo tail -f /var/log/nginx/error.log
Your UpRecruit deployment is now accessible through a clean HTTPS URL such as: