Skip to content

Chapter 7 of 8

Web Servers, SSL/TLS, and Hosting Panels

The two leading open-source web servers on Linux are nginx and Apache. nginx configuration lives in /etc/nginx/nginx.conf with site definitions under sites-available/ and sites-enabled/; syntax is validated with nginx -t and reloaded without dropping connections via nginx -s reload or systemctl reload nginx. Apache, common on Debian/Ubuntu, is managed with a2ensite sitename to enable a virtual host, a2dissite to disable it, and a2enmod modname to enable a module. Configuration is tested with apache2ctl -t or apachectl configtest and reloaded with apachectl graceful. Logs are typically in /var/log/apache2/ on Debian/Ubuntu or /var/log/httpd/ on RHEL/CentOS, while nginx writes to /var/log/nginx/access.log and /var/log/nginx/error.log.

SSL/TLS underpins secure web delivery. certbot --nginx -d domain.com obtains and configures a Let's Encrypt certificate automatically; certbot renew renews any due certificates, with --dry-run simulating renewal. Certificates live under /etc/letsencrypt/live/domain/ as symlinks to the current files. openssl is the swiss-army knife: openssl x509 -enddate -noout -in cert.pem shows expiry; echo | openssl s_client -connect host:443 -servername host 2>/dev/null | openssl x509 -noout -dates gives a quick expiry check from the CLI. CSR creation uses openssl req -new -key private.key -out request.csr, and a self-signed certificate is created with openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout key.pem -out cert.pem. Verifying that a certificate and key match requires comparing their moduli: openssl x509 -modulus -noout -in cert.pem against openssl rsa -modulus -noout -in key.pem. acme.sh is a shell-script alternative to certbot. SNI allows multiple SSL sites on one IP by sending the hostname during the handshake, HSTS tells browsers to always use HTTPS, and OCSP stapling caches revocation status for faster handshakes.

For FTP services, vsftpd and proftpd are the typical server choices. The main vsftpd config is /etc/vsftpd.conf; restarting uses systemctl restart vsftpd, and chroot_local_user=YES jails users to their homes. proftpd offers per-directory configs and virtual users. SFTP, running over SSH on port 22, is generally preferred because it is encrypted and firewall-friendly, unlike FTP on port 21. FileZilla is a popular GUI client with a Site Manager (Ctrl+S) for reusable connections; the Quickconnect bar handles one-off sessions. Transfer modes are Auto, ASCII (text files with line-ending conversion), and Binary (exact copy); settings are in Edit > Settings > Transfers. Hidden files are revealed via Server > Force showing hidden files, and the queue can be cleared, paused, or resumed after failure through Transfer > Process Queue. View > Directory Comparison and View > Synchronized Browsing make it easy to spot and transfer differences between local and remote. Site entries can be exported and imported via File > Export/Import. Errors such as "Connection timed out" usually indicate firewall blocking or a wrong host/port, while "ECONNREFUSED" means the host is reachable but the service is not listening.

Hetzner's konsoleH is a web control panel for shared hosting that bundles many everyday sysadmin tasks. Domains are managed under Domain Administration (DNS settings, addons, parked domains, subdomains); emails under Email (accounts, aliases, forwardings, catch-all, autoresponders, spam filter, webmail); databases under Databases (MySQL creation and phpMyAdmin access); FTP under FTP Accounts (including restricted subdirectory accounts); SSL under SSL (Let's Encrypt activation); and scheduled tasks under Webspace > Cronjobs. PHP version and php.ini directives are tuned under PHP Settings, directory protection under Webspace, and access/error logs under Webspace > Logs or Statistics. Apache custom error pages and HTTPS redirects are typically implemented via .htaccess, for example with RewriteEngine On, RewriteCond %{HTTPS} off, and RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]. Hetzner's Robot, in contrast, manages dedicated servers and cloud infrastructure rather than shared hosting.

All chapters
  1. 1SSH, Remote Access, and File Transfer
  2. 2DNS and Name Resolution
  3. 3Systemd, Logging, and Scheduled Tasks
  4. 4Users, Permissions, and Linux Security
  5. 5Storage, Filesystems, and LVM
  6. 6Networking, Firewalls, and Diagnostics
  7. 7Web Servers, SSL/TLS, and Hosting Panels
  8. 8Process Management, Performance, and Containers

Drill it

Reading is not remembering. These come from the Sysadmin Cards deck:

Q

What is the purpose of the <code>~/.ssh/config</code> file?

It allows users to define shortcuts and configuration options (like Hostname, User, Port, IdentityFile) for SSH connections.

Q

What are the recommended permissions for the <code>~/.ssh/authorized_keys</code> file?

600 (read/write for owner only).

Q

What is a DNS <b>CNAME</b> record?

A Canonical Name record that maps one domain name (alias) to another domain name (canonical).

Q

What is a DNS <b>MX</b> record?

A Mail Exchange record that specifies the mail server responsible for accepting email messages on behalf of a domain.