Files
marketplaces/docs/TROUBLESHOOTING.md
2026-01-18 18:57:06 +04:00

4.4 KiB

🔧 Troubleshooting Guide for 404 and 502 Errors

Quick Diagnosis

Run these commands on your Ubuntu server to diagnose the issue:

# 1. Check if files exist
ls -la /var/www/dexarmarket/browser/index.html

# 2. Check nginx config syntax
sudo nginx -t

# 3. Check nginx error logs (THIS IS MOST IMPORTANT!)
sudo tail -30 /var/log/nginx/error.log

# 4. Check if nginx is running
sudo systemctl status nginx

# 5. Test API from server
curl -v https://api.dexarmarket.ru:445/ping

Error: 404 Not Found

Cause: Files not uploaded or wrong path

Solution 1: Verify files are on server

ls -la /var/www/dexarmarket/browser/

Should show:

  • index.html
  • main-*.js
  • chunk-*.js
  • polyfills-*.js
  • styles-*.css
  • assets/ folder

If files are missing:

# From your local machine:
cd F:\dx\marketplace\Dexarmarket
npm run build
scp -r dist/dexarmarket/browser/* user@your-server:/var/www/dexarmarket/browser/

Solution 2: Fix permissions

sudo chown -R www-data:www-data /var/www/dexarmarket
sudo chmod -R 755 /var/www/dexarmarket

Solution 3: Check nginx config is loaded

# Check which config is active
ls -la /etc/nginx/sites-enabled/

# Should show symlink to dexarmarket config
# If not:
sudo ln -s /etc/nginx/sites-available/dexarmarket /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

Solution 4: Verify nginx root path

sudo cat /etc/nginx/sites-available/dexarmarket | grep root

Should show: root /var/www/dexarmarket/browser;

Error: 502 Bad Gateway

This means the API backend (https://api.dexarmarket.ru:445) is unreachable

Solution 1: Check if API is running

# From Ubuntu server:
curl -v https://api.dexarmarket.ru:445/ping

# If this fails, your API backend is down!

Solution 2: Port 445 is blocked Port 445 is typically blocked by many firewalls because it's used for SMB file sharing.

Check from browser console (F12):

  • Open browser Developer Tools (F12)
  • Go to Console tab
  • Look for errors like: net::ERR_CONNECTION_REFUSED or net::ERR_SSL_PROTOCOL_ERROR

Possible fixes:

  • Use standard port 443 for HTTPS
  • Or use port 8443, 8080, or other non-standard but common ports
  • Configure firewall to allow port 445

Solution 3: CORS issues The API must have CORS headers allowing requests from https://dexarmarket.ru

Check API response headers:

curl -v -H "Origin: https://dexarmarket.ru" https://api.dexarmarket.ru:445/ping

Should include headers like:

Access-Control-Allow-Origin: https://dexarmarket.ru

Solution 4: SSL Certificate issues

# Test with SSL verification disabled
curl -k https://api.dexarmarket.ru:445/ping

# If this works but normal curl doesn't, SSL cert is invalid

Still Not Working?

Get detailed error information:

1. Browser Console (JavaScript errors)

F12 → Console tab
Look for red errors

2. Browser Network Tab (Failed requests)

F12 → Network tab
Reload page
Look for red (failed) requests
Click on failed request to see details

3. Nginx Error Log (Server-side errors)

sudo tail -50 /var/log/nginx/error.log

4. Nginx Access Log (See what requests come in)

sudo tail -50 /var/log/nginx/access.log

5. Test Build Locally

cd F:\dx\marketplace\Dexarmarket\dist\dexarmarket\browser
python -m http.server 8000
# Visit http://localhost:8000

If local test works, the issue is with deployment, not the build.

Common Mistakes

Uploading to wrong directory

  • Correct: /var/www/dexarmarket/browser/
  • Wrong: /var/www/dexarmarket/ (missing browser/)

Wrong permissions

# Must be readable by www-data
sudo chown -R www-data:www-data /var/www/dexarmarket
sudo chmod -R 755 /var/www/dexarmarket

Nginx config not reloaded

# After ANY change to nginx config:
sudo nginx -t
sudo systemctl reload nginx

Old files cached

# Clear browser cache: Ctrl+Shift+R (hard refresh)

API port blocked

  • Port 445 is unusual and often blocked
  • Consider using port 443 (standard HTTPS)

Contact Information for Support

When asking for help, provide:

  1. Output of sudo nginx -t
  2. Last 30 lines of nginx error log: sudo tail -30 /var/log/nginx/error.log
  3. Browser console errors (F12 → Console)
  4. Result of curl -v https://api.dexarmarket.ru:445/ping from server
  5. Screenshot of browser Network tab showing failed request