Ravindra Bagale · AWSसर्व coursesया course चे lessonsशोधाEnglish

AWS · मराठी आवृत्ती

6.1 Web server काय काम करतो?

रवींद्र बागले यांच्या course वर आधारित · सहज मराठीत explanation

या page मध्ये

EC2 तयार आहे, पण website ला उत्तर देणारं software हवं. दुकान आहे पण shutter बंद असेल तर customer ला सेवा मिळत नाही, तशी कल्पना करा.

Web server HTTP साठी 80 आणि HTTPS साठी 443 सारख्या ports वर requests स्वीकारतो आणि HTML, images, CSS, JavaScript किंवा app ने तयार केलेला data परत देतो.

  Browser                         EC2 instance
 +--------+   GET /index.html    +---------------------------------------+
 |        | -------------------> | Web server (Nginx / Apache) :80       |
 |        |                      |   ├─ static file?  → read from disk   |
 |        | <------------------- |   └─ dynamic?      → pass to PHP /    |
 +--------+   200 OK + HTML      |                      Node / Python app|
                                 +---------------------------------------+

तीन मुख्य कामं

  1. Static files disk वरून serve करणं — HTML/CSS/JS/images.
  2. Dynamic requests PHP-FPM, Node किंवा Gunicorn सारख्या backend कडे देऊन response आणणं — reverse proxy/FastCGI integration.
  3. TLS, compression, caching, logs, अनेक virtual hosts, load balancing आणि rate limiting.

HTTP status codes

Codeअर्थनेहमीचं कारण
200OKRequest यशस्वी
301 / 302Permanent / temporary redirectउदा. HTTP → HTTPS
304Not ModifiedCached copy वापरता येते
400Bad RequestRequest malformed
401 / 403Authentication लागते / access forbiddenLogin किंवा permissions/index/SELinux
404Not Foundचुकीचा path किंवा root
500Internal Server ErrorApp/PHP मधला error
502Bad GatewayUpstream response/connection अडचण; app बंद किंवा चुकीचा socket/port
503UnavailableOverload किंवा maintenance
504Gateway TimeoutUpstream कडून वेळेत response नाही

Lab

curl -I https://www.example.com आणि curl -I https://www.example.com/nahi-asa-page run करा. Status आणि उपलब्ध असल्यास Server header नोंदवा. दुसऱ्याला 404 येतो का प्रत्यक्ष तपासा; server चा configured व्यवहार वेगळा असू शकतो.