इसे छोड़कर कंटेंट पर जाएं

सत्यापन

डिप्लॉयमेंट के बाद, यह पुष्टि करने के लिए ये जाँचें चलाएँ कि CDN एज नोड सही तरीके से काम कर रहा है। NGINX इंस्टॉल करने के लिए cloud-init के पूर्ण होने हेतु terraform apply के बाद 2-3 मिनट प्रतीक्षा करें।

सत्यापित करें कि NGINX चल रहा है और रिस्पॉन्स दे रहा है:

Terminal window
curl -s "http://<PUBLIC_IP>/health" | jq .

अपेक्षित आउटपुट:

{
"status": "healthy",
"component": "cdn-edge",
"engine": "nginx",
"vendor_profiles": [
"akamai",
"cloudflare",
"cloudfront",
"fastly",
"azure-front-door"
]
}

यदि Terraform आउटपुट का उपयोग कर रहे हैं:

Terminal window
curl -s "$(terraform output -raw health_check_url)" | jq .

कैश मिस (पहला अनुरोध)

Section titled “कैश मिस (पहला अनुरोध)”

किसी भी पाथ पर पहला अनुरोध कैश मिस होगा — एज, ऑरिजिन सर्वर से फ़ेच करता है:

Terminal window
curl -I "http://<PUBLIC_IP>/"

रिस्पॉन्स में इन हेडर्स को देखें:

X-Cache-Status: MISS
X-CDN-Edge: cdn-simulator

MISS का अर्थ है कि कंटेंट कैश में नहीं था और ऑरिजिन सर्वर से फ़ेच किया गया।

कैश हिट (बाद के अनुरोध)

Section titled “कैश हिट (बाद के अनुरोध)”

तुरंत वही अनुरोध दोहराएँ:

Terminal window
curl -I "http://<PUBLIC_IP>/"

अपेक्षित हेडर्स:

X-Cache-Status: HIT
X-CDN-Edge: cdn-simulator

HIT पुष्टि करता है कि रिस्पॉन्स ऑरिजिन सर्वर से संपर्क किए बिना NGINX डिस्क कैश से सर्व किया गया।

कैश डायरेक्टरी निरीक्षण

Section titled “कैश डायरेक्टरी निरीक्षण”

यह सत्यापित करने के लिए VM में SSH करें कि कैश्ड कंटेंट डिस्क पर मौजूद है:

Terminal window
ssh azureuser@<PUBLIC_IP>
# Check cache directory has content
sudo find /var/cache/nginx/cdn -type f | head -20
# Check cache size
sudo du -sh /var/cache/nginx/cdn

सत्यापित करें कि NGINX चल रहा है और कॉन्फ़िगरेशन मान्य है:

Terminal window
ssh azureuser@<PUBLIC_IP>
# Check service status
sudo systemctl status nginx
# Validate configuration
sudo nginx -t
# View active connections (if stub_status is enabled)
curl -s http://localhost/health

ऑरिजिन कनेक्टिविटी

Section titled “ऑरिजिन कनेक्टिविटी”

सत्यापित करें कि एज नोड ऑरिजिन सर्वर तक पहुँच सकता है:

Terminal window
ssh azureuser@<PUBLIC_IP>
# Test connectivity to origin (replace with your origin URL)
curl -I "https://your-origin.example.com/"

यदि यह विफल हो, तो जाँचें:

  1. Terraform कॉन्फ़िग में origin_server वेरिएबल सही है
  2. ऑरिजिन सर्वर एज नोड के पब्लिक IP से इनबाउंड कनेक्शन की अनुमति देता है
  3. VM से DNS रिज़ॉल्यूशन काम करता है (nslookup your-origin.example.com)

cloud-init लॉग के माध्यम से प्रोविज़निंग प्रगति की निगरानी करें:

Terminal window
ssh azureuser@<PUBLIC_IP> "tail -f /var/log/cloud-init-progress.log"

अपेक्षित चरण: [init], [nic] (डायनामिक NIC डिटेक्शन), [complete]

यदि cloud-init त्रुटियाँ रिपोर्ट करे:

Terminal window
ssh azureuser@<PUBLIC_IP> "sudo cloud-init status --long"

एंड-टू-एंड टेस्ट

Section titled “एंड-टू-एंड टेस्ट”

एक पूर्ण अनुरोध चक्र चलाएँ और रिस्पॉन्स चेन सत्यापित करें:

Terminal window
# First request — MISS (fetches from origin)
echo "=== Request 1 (expect MISS) ==="
curl -s -o /dev/null -w "HTTP %{http_code} | Cache: %{header:X-Cache-Status}\n" "http://<PUBLIC_IP>/test-path"
# Second request — HIT (served from cache)
echo "=== Request 2 (expect HIT) ==="
curl -s -o /dev/null -w "HTTP %{http_code} | Cache: %{header:X-Cache-Status}\n" "http://<PUBLIC_IP>/test-path"

अपेक्षित आउटपुट:

=== Request 1 (expect MISS) ===
HTTP 200 | Cache: MISS
=== Request 2 (expect HIT) ===
HTTP 200 | Cache: HIT

वेंडर हेडर सत्यापन

Section titled “वेंडर हेडर सत्यापन”

/headers पाथ का अनुरोध करके सत्यापित करें कि सभी CDN वेंडर हेडर इंजेक्ट किए जा रहे हैं (httpbin.org को ऑरिजिन के रूप में उपयोग करते समय):

Terminal window
curl -s "http://<PUBLIC_IP>/headers" | python3 -m json.tool

अपेक्षित रिस्पॉन्स में सभी पाँच वेंडर्स के हेडर शामिल हैं:

{
"headers": {
"True-Client-Ip": "<YOUR_CLIENT_IP>",
"Cf-Connecting-Ip": "<YOUR_CLIENT_IP>",
"Cf-Ipcountry": "US",
"Cf-Ray": "<request_id>-SJC",
"Cf-Bot-Score": "85",
"Cf-Ja3-Hash": "e7d705a3286e19ea42f587b344ee6865",
"Cloudfront-Viewer-Country": "US",
"Cloudfront-Viewer-City": "San Jose",
"Cloudfront-Is-Desktop-Viewer": "true",
"Cloudfront-Is-Mobile-Viewer": "false",
"Fastly-Client-Ip": "<YOUR_CLIENT_IP>",
"X-Akamai-Edgescape": "georegion=263,country_code=US,...",
"X-Azure-Clientip": "<YOUR_CLIENT_IP>",
"X-Azure-Fdid": "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"X-Geo-Country-Code": "US"
}
}

डिवाइस डिटेक्शन टेस्ट

Section titled “डिवाइस डिटेक्शन टेस्ट”

डिवाइस डिटेक्शन हेडर परिवर्तन सत्यापित करने के लिए मोबाइल User-Agent के साथ टेस्ट करें:

Terminal window
curl -s "http://<PUBLIC_IP>/headers?device=mobile" \
-H "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X)" \
| python3 -m json.tool | grep -E "Is-Mobile|Is-Desktop|is_mobile"

अपेक्षित:

"Cloudfront-Is-Desktop-Viewer": "false",
"Cloudfront-Is-Mobile-Viewer": "true",
Terminal window
ssh azureuser@<PUBLIC_IP>
sudo systemctl status nginx
sudo journalctl -u nginx --no-pager -n 50

Cloud-init पूर्ण नहीं हुआ

Section titled “Cloud-init पूर्ण नहीं हुआ”

terraform apply के बाद, cloud-init में 2-3 मिनट लगते हैं। प्रगति जाँचें:

Terminal window
ssh azureuser@<PUBLIC_IP>
sudo cloud-init status
sudo tail -f /var/log/cloud-init-output.log

कैश हमेशा MISS दिखा रहा है

Section titled “कैश हमेशा MISS दिखा रहा है”
  • सत्यापित करें कि ऑरिजिन कैश योग्य रिस्पॉन्स कोड (200, 301, 302) लौटाता है
  • जाँचें कि ऑरिजिन Cache-Control: no-cache या no-store हेडर नहीं भेजता
  • NGINX एरर लॉग जाँचें: sudo tail -f /var/log/nginx/error.log

पोर्ट 80/443 पर कनेक्शन अस्वीकृत

Section titled “पोर्ट 80/443 पर कनेक्शन अस्वीकृत”
  • सत्यापित करें कि NSG नियम लागू हैं: az network nsg rule list --nsg-name "$(terraform output -raw nsg_name)" --resource-group "$(terraform output -raw resource_group_name)" -o table
  • सत्यापित करें कि NGINX सुन रहा है: ssh azureuser@<PUBLIC_IP> "sudo ss -tlnp | grep nginx"