Linux

Apache: Setup & Virtual Hosts

46 flashcards · answers and review in the app — launching soon

When choosing between the two leading open-source web servers, what tradeoff pushes you toward Apache over NGINX?
You wrote a script that runs systemctl enable --now httpd, but on a colleague's Debian box it fails with 'unit not found'. What went wrong?
Apache is running and http://localhost works on the server itself, but nobody outside the machine can reach it on Fedora/RHEL. What's the most likely cause and fix?
Why isn't the Apache web server process run as root, and what does that imply for your HTML files?
On a Fedora/RHEL box, permissions on your HTML files look correct but Apache still returns forbidden. What extra layer is likely to blame?
Why did modern Apache abandon the single monolithic httpd.conf in favor of many smaller files pulled in by include statements?
On Debian/Ubuntu, how does Apache's available/enabled directory pattern work, and which command family manages it?
On SUSE, you edited a file under sysconfig.d/ to load a module but it reverts on every Apache restart. Where should the change actually go?
Before reloading Apache after a config edit, what's the one-line safety check, and why does Debian/Ubuntu need an extra step first?
You changed the SSL certificate paths and ran systemctl reload apache2, but the new cert isn't served. What did you miss?
You set ServerName in the main Apache config but it doesn't take effect. What additional directive commonly fixes this?
Pages show garbled accented characters in the browser. How does Apache decide which character set to advertise, and what do the two AddDefaultCharset modes do differently?
You added AddCharset rules and a charset setting in .htaccess, but the .htaccess part is being ignored. What two prerequisites are you missing?
Apache logs are among the fastest-growing files on a server. What handles their rotation by default, and what must you do after adding custom per-vhost log paths?
On a default Debian/Ubuntu install, the VirtualHost block in 000-default.conf is bound to no IP and no hostname. What role does such an unbound vhost play?
Inside a VirtualHost block, what do DocumentRoot, ServerAdmin, ErrorLog/CustomLog, and LogLevel each control, and what's LogLevel's default?
You want a custom 404 page and you want the URL /mytool to serve files from /usr/local/mytool. Which two directives do you reach for, and how do they differ?
When a browser requests a directory URL ending in / rather than a specific file, how does Apache decide what to send back?
Why is the Indexes option a security risk, and how do you switch off a single option that a directory inherited from its parent?
Your .htaccess file is being completely ignored. Which directive on the parent Directory decides whether .htaccess is honored, and what's the Debian/Ubuntu default?
In Apache 2.2's Order/Allow/Deny model, why can 'Order Deny,Allow' leave a directory unexpectedly open?
For a fresh Apache 2.4 config, which keyword replaces the old Order/Allow/Deny, and what are its common forms?
You put three Require lines in one Directory block expecting a visitor to satisfy all of them. Why does matching just one already grant access, and how do you force AND logic?
When setting up basic-auth password protection, where should the htpasswd password file live, and why not just drop it in the web directory?
Which four directives make up a basic-auth protected Directory block, and what does AuthName (the realm) actually buy you?
You put AuthType/AuthUserFile/Require into an .htaccess file to protect a directory, but there's no password prompt at all. What's missing on the parent directory?
Apache can pick which virtual host serves a request in three ways. Which is the default choice in practice and why, and what's the drawback of the IP-based method?
It used to be impossible to run HTTPS with name-based virtual hosts. What changed to make it work, and which directive must be set?
When defining a name-based virtual host, what does ServerName vs ServerAlias do, and why do you typically end up with two VirtualHost blocks per host?
On Debian/Ubuntu you enabled your new vhost, then ran a2dissite on the default site to tidy up — and things broke. What's the rule about the default site?
By default all vhosts write to shared central log files. How do you give each virtual host its own separate error and access logs?
What's the fundamental difference between log-file analyzers like GoAccess/Webalizer/AWStats and JavaScript-based analytics like Google Analytics or Matomo?
What makes GoAccess a practical middle-ground analytics tool, and how do you get either a live terminal view or an HTML report from it?
Feeding all your rotated, compressed logs into goaccess at once can hurt. What's the cost, and how do you cap the input to recent logs?
RHEL ships several PHP versions in parallel via AppStream modules. Which commands switch the active version before you install?
What's the minimal file to confirm PHP is working, why do PHP scripts not need the execute bit, and why shouldn't that test file stay online?
Apache handles concurrent requests via multiprocessing modules. For running PHP, how does the modern FPM/FastCGI approach compare with the old prefork module?
On Ubuntu 22.04, what's the sequence to switch PHP from the prefork module to FPM/FastCGI?
A browser shows raw PHP source or offers your .php file for download instead of running it. What does that symptom mean, and what can mask a fix that already worked?
NGINX now outranks Apache in market share on the strength of static-content speed. For a typical PHP or Java site, how much of that advantage actually carries over?
What do the acronyms LAMP and LEMP stand for, and where does the odd 'E' in LEMP come from?
How does NGINX route a PHP request to php-fpm, and what Debian/Ubuntu-specific pitfall causes it to complain about duplicate config?
In NGINX, which directives configure the HTTPS certificate and which set up basic-auth password protection, and where does the htpasswd tool come from?
Which goaccess option turns a static HTML report into a live-updating page, and what extra parameters does it need when served over HTTPS?
In a PHP page, how does the request flow through Apache, and why can a visitor never see the PHP source?
You installed the PHP packages but pages still don't execute PHP. What step is commonly forgotten, and what's the extra requirement on Fedora/RHEL?
Apache: Setup & Virtual Hosts (Linux) · KnowCard