Let’s walk through a systematic approach to identifying and fixing the issue.
Step 1: Confirm Your Server Is Reachable Internally
Use curl or a browser to access your app directly on the local machine:
bash
curl http://localhost:3000
If it works locally, move on. If not, your app or backend service is not running or is failing.
Step 2: Check NGINX Status
Run:
bash
sudo systemctl status nginx
Make sure it’s active (running). If not, restart and check errors:
bash
sudo systemctl restart nginx
sudo journalctl -xe
Step 3: Check NGINX Configuration
Open your site config, usually located at /etc/nginx/sites-available/yourdomain.conf:
nginx
server {
listen 80;
server_name yourdomain.duckdns.org;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Make sure the proxy_pass URL points to the correct IP and port.
Test the config:
bash
sudo nginx -t
If syntax is OK, reload:
bash
sudo systemctl reload nginx
Leave a Reply