A web server

A web server is software that serves web content (like HTML, CSS, JS, or images) to clients (usually web browsers) over the HTTP or HTTPS protocol.


On Linux, web servers are typically daemon processes (background services) that listen on port 80 (HTTP) or 443 (HTTPS) and handle requests according to configuration files.


How these work

* A browser sends an HTTP request to a server (e.g., GET /index.html).

* The web server software (like Apache or Nginx) listens for requests on a TCP port.

* The server determines what to do:
Serve a static file (e.g., image, HTML).
Pass the request to a dynamic handler (e.g., PHP, Python, Node.js, etc.).

* The server sends back the content with an HTTP status code.


_________________________________________

Popular Web Servers on Linux

* Apache HTTP Server (httpd)
Oldest and most widely used open-source web server.
Modular architecture — load modules like mod_ssl, mod_rewrite, mod_php.
Configured mainly through /etc/httpd/ or /etc/apache2/ (depending on the distro).
Great for .htaccess-based per-directory control.

* Nginx
Lightweight, high-performance, event-driven web server.
Often used as a reverse proxy or load balancer.
Excellent for handling many concurrent connections.
Config in /etc/nginx/nginx.conf and /etc/nginx/sites-available/.

* Lighttpd
Designed for low-resource environments.
Ideal for embedded systems or high-performance static content.
Simple configuration and lower memory usage than Apache.

* Caddy
Modern web server with automatic HTTPS via Let’s Encrypt.
Very easy configuration — a single Caddyfile.
Great for quick deployments or developers who want minimal setup.

* Tomcat / Jetty
Focused on serving Java-based web applications (Servlets, JSP).
Tomcat is often paired with Apache or Nginx as a backend app server.


_________________________________________

Important:

* Use firewalls (e.g., ufw, iptables) to allow only ports 80 and 443.

* Always enable HTTPS — use Certbot with Let’s Encrypt.

* Keep software updated (apt upgrade / dnf upgrade).

* Limit file permissions (/var/www should not be writable by everyone).

* Use caching (e.g., Varnish, Redis, or Nginx caching).


Enjoy #linux

A web server



Well, that was exciting. See you in the next one!