very first commit
This commit is contained in:
193
docs/TROUBLESHOOTING.md
Normal file
193
docs/TROUBLESHOOTING.md
Normal file
@@ -0,0 +1,193 @@
|
||||
# 🔧 Troubleshooting Guide for 404 and 502 Errors
|
||||
|
||||
## Quick Diagnosis
|
||||
|
||||
Run these commands on your Ubuntu server to diagnose the issue:
|
||||
|
||||
```bash
|
||||
# 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**
|
||||
```bash
|
||||
ls -la /var/www/dexarmarket/browser/
|
||||
```
|
||||
|
||||
Should show:
|
||||
- `index.html`
|
||||
- `main-*.js`
|
||||
- `chunk-*.js`
|
||||
- `polyfills-*.js`
|
||||
- `styles-*.css`
|
||||
- `assets/` folder
|
||||
|
||||
**If files are missing:**
|
||||
```bash
|
||||
# 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**
|
||||
```bash
|
||||
sudo chown -R www-data:www-data /var/www/dexarmarket
|
||||
sudo chmod -R 755 /var/www/dexarmarket
|
||||
```
|
||||
|
||||
**Solution 3: Check nginx config is loaded**
|
||||
```bash
|
||||
# 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**
|
||||
```bash
|
||||
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**
|
||||
```bash
|
||||
# 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:
|
||||
```bash
|
||||
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**
|
||||
```bash
|
||||
# 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)**
|
||||
```bash
|
||||
sudo tail -50 /var/log/nginx/error.log
|
||||
```
|
||||
|
||||
**4. Nginx Access Log (See what requests come in)**
|
||||
```bash
|
||||
sudo tail -50 /var/log/nginx/access.log
|
||||
```
|
||||
|
||||
**5. Test Build Locally**
|
||||
```bash
|
||||
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**
|
||||
```bash
|
||||
# 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**
|
||||
```bash
|
||||
# After ANY change to nginx config:
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
```
|
||||
|
||||
❌ **Old files cached**
|
||||
```bash
|
||||
# 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
|
||||
Reference in New Issue
Block a user