- 2070 Bhadra · 4+7 marks
HTTP request methods; web server and virtual hosting
Short answer
Key HTTP methods: GET (retrieve), POST (submit), HEAD (headers). Web server config: set IP, install, define ServerName/DocumentRoot, open port, restart. Virtual hosting: IP-based, port-based, name-based (uses Host header).
Explain the request methods of HTTP? Write the major steps while configuring web server and the types of web hosting (Virtual Hosting) from your web server.
HTTP request methods
The first line of an HTTP request is: METHOD URL VERSION. The main methods:
| Method | Purpose |
|---|---|
| GET | Retrieve the resource named by the URL. Data in the query string; no body. Safe and idempotent. |
| POST | Send data (form input, file upload) in the body for the server to process. |
| HEAD | Like GET but the server returns only headers, not the object. Used to check size/modification time. |
| PUT | Upload/replace the resource at the URL. |
| DELETE | Remove the resource at the URL. |
| OPTIONS | Ask which methods the server supports. |
| TRACE | Echo the request back, for diagnostics. |
| CONNECT | Make a tunnel through a proxy (used for HTTPS). |
Example: GET /index.html HTTP/1.1 with header Host: www.example.com.
Major steps to configure a web server (Apache on Linux)
- Assign a static IP address and set a host name; set up DNS (A record) for the site.
- Install the software:
yum install httpdorapt install apache2. - Edit the main configuration (
httpd.conf/apache2.conf):Listen 80,ServerName,DocumentRoot /var/www/html,DirectoryIndex index.html, access rules in<Directory>. - Put the web pages in the document root and set file permissions.
- Open port 80 (443 for HTTPS) in the firewall.
- Test syntax (
apachectl configtest), start and enable the service (systemctl enable --now httpd). - Browse to
http://server-ip/and check the logs in/var/log/httpd/.
Types of virtual hosting
Virtual hosting lets one server host several sites.
- IP-based: each site has its own IP address;
<VirtualHost 192.168.1.10:80>. - Port-based: same IP, different ports;
<VirtualHost *:8080>. - Name-based: same IP and port, selected by the HTTP
Host:header.
<VirtualHost *:80>
ServerName www.a.com
DocumentRoot /var/www/a
</VirtualHost>
<VirtualHost *:80>
ServerName www.b.com
DocumentRoot /var/www/b
</VirtualHost>
Name-based hosting is the most economical because only one IP address is needed. IP-based hosting is required when each site needs its own SSL certificate on old clients.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Virtual hosting types; name-based steps · Internet and Intranet, chapter 4 · asked 2×
- Virtual hosting and HTTP connections · Internet and Intranet, chapter 4
- HTTP working, methods, virtual hosting · Internet and Intranet, chapter 4
- Short note: Web virtual hosting · Internet and Intranet, chapter 4 · asked 2×
- HTTP request served by server · Computer Networks and Security, chapter 6
- Web and file server communication · Computer Networks and Security, chapter 6
- Short note: Web server · Computer Networks and Security, chapter 6
- Steps of virtual (unit) load method · Theory of Structures I, chapter 3 · asked 4×