Chapter 6: Web Servers — Nginx and Apache
6.3 Quick reference: package, service, paths per OS
Friends, this table is the most used page in my class. Three OSes and two web servers – package, service, config and web root, all in one place. No need to memorise it, just remember where to look.
मित्रांनो, हा टेबल माझ्या क्लासमधला सगळ्यात जास्त वापरला जाणारा पेज आहे. तीन OS आणि दोन वेब सर्व्हर्स – पॅकेज, सर्व्हिस, कॉन्फिग आणि वेब रूट एकाच ठिकाणी. पाठ करायला नको, फक्त कुठे बघायचं ते लक्षात ठेवा.
दोस्तों, ये टेबल मेरी क्लास का सबसे ज़्यादा इस्तेमाल होने वाला पेज है. तीन OS और दो वेब सर्वर्स – पैकेज, सर्विस, कॉन्फ़िग और वेब रूट एक ही जगह. रटने की ज़रूरत नहीं, बस याद रखो कि कहाँ देखना है.
These are distribution package starting points. Use the loaded site configuration and exact response to verify runtime paths and worker identities.
| Item | Amazon Linux 2023 | Ubuntu 22.04 / 24.04 | CentOS Stream 9 |
|---|---|---|---|
| Nginx package / service | nginx / nginx |
nginx / nginx |
nginx / nginx |
| Nginx main config | /etc/nginx/nginx.conf |
/etc/nginx/nginx.conf |
/etc/nginx/nginx.conf |
| Nginx site configs | /etc/nginx/conf.d/*.conf |
/etc/nginx/sites-available/ + symlink in sites-enabled/ (also conf.d/) |
/etc/nginx/conf.d/*.conf |
| Nginx default web root | /usr/share/nginx/html |
/var/www/html |
/usr/share/nginx/html |
| Nginx worker user | nginx |
www-data |
nginx |
| Nginx logs | /var/log/nginx/ |
/var/log/nginx/ |
/var/log/nginx/ |
| Apache package / service | httpd / httpd |
apache2 / apache2 |
httpd / httpd |
| Apache main config | /etc/httpd/conf/httpd.conf |
/etc/apache2/apache2.conf |
/etc/httpd/conf/httpd.conf |
| Apache site configs | /etc/httpd/conf.d/*.conf |
/etc/apache2/sites-available/ (enable with a2ensite) |
/etc/httpd/conf.d/*.conf |
| Apache default web root | /var/www/html |
/var/www/html |
/var/www/html |
| Apache user | apache |
www-data |
apache |
| Apache logs | /var/log/httpd/ |
/var/log/apache2/ |
/var/log/httpd/ |
| Config test | sudo nginx -t / sudo apachectl configtest |
sudo nginx -t / sudo apache2ctl configtest |
sudo nginx -t / sudo apachectl configtest |
| Service state after installation | Check the selected unit with systemctl is-active and systemctl is-enabled. Package scripts, image policy and listener conflicts can affect the result. |
||
| Network and filesystem controls | Verify the actual host firewall or security policy, and the EC2 security group if applicable. These settings depend on the particular image and traffic path. | ||
Ravindra Bagale's Tip
Check the distribution before choosing the Apache unit name. Ubuntu commonly uses apache2.service. Amazon Linux 2023 and CentOS Stream packages generally use httpd.service. Installation, current running state and enablement are separate checks.
Ravindra Bagale's Tip – मराठी
Apache unit निवडण्याआधी distribution तपासा. Ubuntu मध्ये साधारण apache2.service, Amazon Linux 2023 आणि CentOS Stream मध्ये httpd.service असतो. Installation, सध्याची running state आणि enablement वेगवेगळे तपासा.
Ravindra Bagale's Tip – हिंदी
Apache unit चुनने से पहले distribution देखो. Ubuntu में आम तौर पर apache2.service, Amazon Linux 2023 और CentOS Stream में httpd.service होता है. Installation, अभी की running state और enablement अलग-अलग जाँचो.
Lab
Chala, identify your assigned machine with cat /etc/os-release. Read its installed package and unit state. Find the server configuration actually used by the assigned site, then compare its listener, root and worker identity with the package reference. Use the local inventory exercise below if you do not have a matching Linux host.
Turn a reference table into a verified server inventory
The same pickup site is used in three training environments. One runs Amazon Linux 2023, another Ubuntu and another CentOS Stream 9. The browser request has the same purpose in each case. The package names, service names and usual configuration directories can differ. On one machine an Apache service is called httpd. On another it is apache2. A student who checks the wrong name can see a missing unit and believe the website must be down. Another student can edit an existing file under a default root while the active site is serving from a completely different directory.
A useful inventory follows the running system in order. Identify the distribution and release. Record the installed package and command. Identify which service unit or other process manager starts it. Find the active configuration entry point and included site definitions. Then locate the actual listener, document root, worker identity and log for the requested site. This sequence separates what a package usually supplies from what the current host uses. It also gives you a procedure for interpreting a guide whose paths do not match your machine.
This lesson provides starter locations for the common distribution packages. Treat them as places to inspect. Images, custom builds, containers and administrator choices can change paths and service behavior. A file listed in a package can be absent on a minimal host or replaced by a newer site configuration. A custom service can select a different file using command-line options. You will build a read-only inventory on your assigned host when possible and use a fully worked sample when those packages or the systemd manager are unavailable.
The learning task is evidence collection. Do not install or restart something merely because an inventory field is missing. First decide which server and site you have been asked to examine. A shared host can run unrelated services. Keep your checks attached to the particular name, path and port assigned to your course. The final proof of the inventory is an appropriate response from the exact named site. The inventory does not authorize changes to any of the resources it describes.
Identify the actual Linux environment
Run the release check where the target program runs. If you are working from a laptop, an SSH terminal and your local terminal can point to different machines. Inside a container, the installed files, process namespace and available service manager can differ from the container host. A systemd command that reports the environment was not booted with systemd tells you something about your current context. It does not establish that a web server executable is absent. Confirm where the assigned program is meant to run before collecting the inventory.
if [ -r /etc/os-release ]; then
grep -E '^(PRETTY_NAME|ID|VERSION_ID)=' /etc/os-release
else
printf '%s\n' 'Use the printed Linux sample if this is not the assigned Linux host.'
fi
uname -m
command -v systemctl
The release file identifies the operating system using recognizable fields. The machine architecture can affect which packages or binary builds are available. An Arm-based EC2 instance and an x86-64 instance can run the same distribution with different compatible packages. The final command shows whether the shell resolves a systemctl program. The presence of the command alone does not prove the system manager is running here. Keep the release, host context and manager as separate entries in the inventory.
Amazon Linux 2023 uses DNF for package management. Its YUM compatibility name is not a reason to treat every RPM-based guide as interchangeable. CentOS Stream 9 also uses the DNF ecosystem for its release packages. Ubuntu 22.04 and 24.04 use the APT and dpkg ecosystem. A distribution guide gives you the usual package names and management conventions for its release. The installed software may come from a custom package repository or build. If the host has both a packaged executable and another copy, check which file starts with the service you are reviewing.
A package name identifies a software bundle in its package ecosystem. A command name identifies something the shell can resolve. A service name identifies a unit or otherwise managed work. Those three often resemble one another and still represent different things. The Nginx package and service share the short label on our three distribution examples. The Apache executable, command wrappers, package and service are more likely to visibly differ. Write one column for each identity so an instruction such as “check Apache” has an exact next step.
Use common package paths as starting points
These tables summarize conventional paths for the distribution packages. They assume the usual systemd-based installation where a unit is mentioned. A custom image can change file layout. For a directory path, check the actual configuration directives and where they apply. If you inspect a packaged source list, distinguish a packaged default file from a site that is actually selected for the request.
| Nginx item | Amazon Linux 2023 | Ubuntu 22.04 or 24.04 | CentOS Stream 9 |
|---|---|---|---|
| Package and unit | nginx and nginx.service | nginx and nginx.service | nginx and nginx.service |
| Usual main configuration | /etc/nginx/nginx.conf | /etc/nginx/nginx.conf | /etc/nginx/nginx.conf |
| Usual site input | /etc/nginx/conf.d when included | sites-available with links in sites-enabled and other configured includes | /etc/nginx/conf.d when included |
| Common packaged starter root | /usr/share/nginx/html | /var/www/html in the distribution default site | /usr/share/nginx/html |
| Worker and log starting points | nginx and /var/log/nginx | www-data and /var/log/nginx | nginx and /var/log/nginx |
| Apache item | Amazon Linux 2023 | Ubuntu 22.04 or 24.04 | CentOS Stream 9 |
|---|---|---|---|
| Package and unit | httpd and httpd.service | apache2 and apache2.service | httpd and httpd.service |
| Usual main configuration | /etc/httpd/conf/httpd.conf | /etc/apache2/apache2.conf | /etc/httpd/conf/httpd.conf |
| Usual site input | /etc/httpd/conf.d when included | sites-available with links in sites-enabled under /etc/apache2 | /etc/httpd/conf.d when included |
| Common packaged starter root | /var/www/html | /var/www/html | /var/www/html |
| Worker and log starting points | apache and /var/log/httpd | www-data and /var/log/apache2 | apache and /var/log/httpd |
A common question is where to upload a new page. The table gives you the familiar default, which is one candidate. The web server selects a particular site and handler for one request. The site can specify its own root or route mapping. An Ubuntu package can include an example file in a shared directory while its default enabled site uses the website directory shown in the table. A package manifest tells you what paths the package supplies. It does not settle which one serves the requested site.
On Ubuntu, the available-site and enabled-site directories have different roles. A file in the available directory is a candidate configuration. A link in the enabled set can let the main configuration include it. Apache provides distribution helpers such as a2ensite for that workflow. Nginx's enabled-link workflow depends on its configured includes. In either case verify the link's destination and that the running service applied the intended configuration. An enabled site file and an enabled service unit are separate mechanisms with different effects.
Other packages can handle sites with include patterns matching names ending with .conf. A backup copied into a matched include path can accidentally become another active configuration. A file with a different name might be ignored even when it is physically in the same folder. Read the actual include directive. Store approved configuration backups outside the interpreted include set. Require a syntax check and an authorized application of changes when performing a separate deployment.
Check installed versions and package-owned paths
In an RPM-family learning environment, query the installed package database with rpm -q. A successful package query normally names the installed build, including a distribution version and architecture. An absent package diagnostic tells you the expected package record is not installed in that database. The executable might still be available through another installation. List package-owned paths when you need to learn what the package supplied, and compare with the actual service route. A path owned by a package can be a configuration input saved and modified locally.
# Amazon Linux 2023 or CentOS Stream 9, run the relevant lines
rpm -q nginx
rpm -q httpd
rpm -ql nginx | grep -E '/(nginx\.conf|nginx\.service)$'
rpm -ql httpd | grep -E '/(httpd\.conf|httpd\.service)$'
These are inspection commands for a system where the RPM tool is available. Query the selected package before its file list. The pipeline prints matching paths from the listing. If it is empty, check whether the package query succeeded and whether configuration files are shipped by a related package. In a split packaging setup a companion package can own directories or configuration. An empty filtered listing is not enough to choose a new filesystem path. Check the package documentation and actual files.
# Ubuntu, run the relevant lines
dpkg-query -W -f='${Status} ${Version}\n' nginx
dpkg-query -W -f='${Status} ${Version}\n' apache2
dpkg-query -L nginx-common | grep -E '/(nginx\.conf|nginx\.service)$'
dpkg-query -L apache2 | grep -E '/(apache2\.conf|apache2\.service)$'
The formatted query for a Debian package prints its recorded state and version. It helps distinguish an installed package from a configuration record left behind by a removal. The package file list may be in a related package such as nginx-common. In Ubuntu 22.04 and 24.04, package manifests can show differently spelled locations for the same kind of unit file, such as a path under /lib or /usr/lib. Distribution layout and filesystem links can account for the difference. Use the system manager's actual loaded path if you need to know which unit file it chose.
Check command resolution separately. A program can be built in a custom installation and put ahead of the packaged command in the shell search path. An approved service can refer to an absolute executable path rather than using the interactive path. Find the service's description through its authorized manager if you need to connect the running server to the right binary. A failed shell lookup by a normal user can also be caused by a search path that omits administrative executable directories. Corroborate the result from the package or manager before declaring the server missing.
Keep installed, running and enabled as different observations
Putting a package on disk is one step. Starting a service makes an instance active under a manager. Enabling a service usually connects it to an activation or boot dependency according to the unit's install rules. These steps can be performed separately. A unit can be installed and disabled while it is running now because someone started it manually or a dependency requested it. Conversely an enabled unit can be inactive or failed. Always read both state and enablement instead of assuming that one proves the other.
Some distribution installations try to start a service automatically. An image's policies, a package script, a container startup environment, a preexisting address conflict or an administrator's choices can affect the result. On an ordinary Linux system where systemd manages the service, systemctl is-active and systemctl is-enabled ask different questions. Their outputs can report more cases than a binary yes or no. A static or generated unit can behave differently from a routinely enabled service. Read the exact state and its meaning under your local systemd documentation.
# On a systemd-based lab where nginx.service is the selected unit
systemctl show -p LoadState -p ActiveState -p UnitFileState -p FragmentPath nginx.service
systemctl is-active nginx.service
systemctl is-enabled nginx.service
Choose the actual unit for your lab. For the packaged Apache service this might be apache2.service or httpd.service. A query returning a nonzero status for an inactive or disabled unit may be the information you wanted. Capture the printed word and any accompanying diagnostic. The structured properties help you distinguish a missing unit from a loaded one and see the filesystem path for its primary unit definition. Configuration fragments and manager overrides can extend the effective definition. Inspect such details only where needed and authorized.
A packaged unit file is a starting point. An administrator can override parts of its configuration in another directory. A custom program may not be owned by the distribution's default unit at all. If your lab uses a temporary standalone Nginx or Apache process, verify it by its own process and listener checks. Creating an isolated lab instance does not require setting a global unit to start at boot. Choose the appropriate evidence for how the process was started. A container might use its configured entrypoint in place of the distribution service manager.
Suppose a package query returns its version and the system manager reports a loaded unit with ActiveState=active and UnitFileState=disabled. Your note can say the named service is running now and its normal enablement state is disabled. If the team expects it to start at boot, investigate the desired activation setup under the service owner. The immediate web request needs its own check. Editing boot settings does not explain why a particular file is missing from an active listener.
Find the named site's active document path and log
A file existing on disk is the first observation. Test whether it is part of the effective configuration. Nginx supports options for using an alternate configuration and for validating and printing parsed inputs. Apache can use a packaged wrapper and can display how virtual hosts are configured. These commands can require access to configuration files, keys, logs or runtime paths. Use them with the appropriate environment and authorization. The full output can include private data or configuration for other sites. Limit what you collect or share to the target you are allowed to inspect.
For an approved named site, connect five values. Record the listening address and port. Record the hostname and matching server block or virtual host. Record the root or appropriate proxy route and any path-specific overrides. Identify the worker that needs file or backend access. Finally record the location or mechanism for the access and error logs for that site. A root setting in the global config can be replaced within a site or location. A log can be written to a named file or through a different mechanism. The table gives starting points for a default setup.
For an isolated lab, use a tool to inspect a known configuration and compare the output with one authorized request. Nginx's -t checks configuration syntax and attempts to open referenced files. Its -T adds a configuration dump and reads the configuration tree visible to that invocation. A running service may still use a prior configuration or a different path argument. On Ubuntu, the Apache wrapper loads packaging environment details. Use the matching wrapper or known isolated httpd settings for that environment.
A local HTTP request completes the chain. For a confirmed learning listener, choose the correct hostname and path in the request. A bare IP may select a default site. If the response has a known content marker, compare it to the expected root, file or upstream result. The response itself is evidence for what is being served now. A successful syntax test and recent file timestamps are helpful clues. For HTTPS, keep the intended hostname for TLS validation and use the environment's approved client and endpoint settings.
Worker identity affects why a root path may fail. A web server can have a master or parent process with one identity and workers with a different identity. It may also run entirely under a service account or isolated process model. Reading a file with your SSH account proves your identity's access. For the real handler, verify traversal permissions on the full resolved path and then file permissions or upstream access. The site's error record can narrow the exact operation. Review additional mandatory access controls and service restrictions where they apply. Avoid copying file ownership from another distribution's default without matching the actual runtime role.
Build a read-only inventory and interpret its result
Use your assigned Linux learning machine when possible. Choose one known web server for the exercise. If you are on a different system or the package is absent, use the fictional reports below. You can complete the skill by tracing which claims each observation supports. The exercise needs no service changes to answer the questions. If a check needs access you lack, record that boundary as part of the evidence.
Record the distribution and release from the release file. Select the matching package tool. Ask for the particular installed package and the command resolution. Decide whether the result shows an installed distribution package, another installation, or a missing piece of evidence. Record the exact label instead of writing only Apache or Nginx.
On systems with an appropriate manager, check the known service's load, active and enablement state. Confirm the unit's name from the package or course. Write the discovered unit path if shown. If no systemd manager applies, name the actual context, such as a standalone teaching process or a container's configured command.
Read the permitted site definition or view from the scoped configuration. Record the address and port actually selected, the hostname, root or backend path and log target. Mark any reference-table location that belongs only to a different distribution or a default configuration.
If you have an authorized local or test URL for the named site, retrieve the intended resource and record its status plus a content marker. Use a read-only request. Stop at the first evidence gap if a request fails. If the host is unavailable, reason from the example below and say which live check would decide it.
Host case: Ubuntu 24.04 training system
Expected package: apache2
Observed unit: apache2.service
LoadState=loaded
ActiveState=active
UnitFileState=disabled
Selected training site: pickup.example.test
Site file: /etc/apache2/sites-enabled/pickup.conf
Configured file root: /srv/pickup-review/site
Expected marker: Morning collection 06:45
Read the report as observations. The service is active now while the unit reports disabled enablement. The installed package and unit naming fit Ubuntu. The desired site's root differs from the packaged default. The next response must use the intended hostname and route to verify the marker. If a colleague edits the default directory and then observes the same answer, the stated active root explains why their edit did not affect this site. Check how the enabled filename resolves and which site is selected before changing a file.
Host case: CentOS Stream 9 training system
Known package: nginx
Known unit: nginx.service
LoadState=loaded
ActiveState=failed
UnitFileState=enabled
Startup observation: listener address already in use
The enabled state does not show that the service started successfully. For this sample, the diagnostic indicates a listener bind conflict. A read-only socket inventory on the assigned host can identify which address and port currently have a listener and, where available, which process owns it. Do not assume that other service is disposable. The next step is to compare the intended bindings and contact the owner if the existing listener serves another site. A scoped learning configuration can use a separate address or port, just as in the independent comparison lab.
For your entry, give six fields and tie each one to evidence. Distribution and package are from the operating system and package database. Service identity and state are from the manager when it applies. Hostname, route mapping and log target are from active configuration evidence. Response status and marker are from the actual request. The exercise makes the reference usable by showing which fields still need verification. An empty cell is a useful statement about the current evidence.
Trace an enabled site with a disposable configuration model
Here is a local exercise for learners who do not have the three Linux distributions. It models the pieces of a package and site inventory with plain text. It can also be used on an assigned Linux practice machine. The package worksheet gives two candidate directories, a unit worksheet gives the separate service states and a site link selects one document directory. There is no running web service in this fixture. Your task is to use the file and link evidence to determine which content marker would belong to the intended site. This is the part of the diagnostic that is the same when a deployment has a real server process.
Start in Bash under your normal account. The preparation block creates an empty temporary directory for this model. If an operation fails, stop before using the relative paths in the next block. Read the final printed path and compare it with the unique name. The records below imitate observations and are here for you to read. They are not executable or system configuration files.
inventory_lab=$(mktemp -d "$HOME/web-inventory-lesson.XXXXXXXX") &&
cd -- "$inventory_lab" &&
mkdir -p ./sites-available ./sites-enabled ./roots/default ./roots/pickup &&
printf '%s\n' 'Packaged welcome page' > ./roots/default/index.html &&
printf '%s\n' 'Morning collection 06:45' > ./roots/pickup/index.html &&
printf '%s\n' 'root ./roots/default' > ./sites-available/default.conf &&
printf '%s\n' 'root ./roots/pickup' > ./sites-available/pickup.conf &&
ln -s ../sites-available/pickup.conf ./sites-enabled/pickup.conf &&
printf '%s\n' 'LoadState=loaded' 'ActiveState=active' 'UnitFileState=disabled' > ./unit-example.txt &&
pwd && ls -ld -- ./sites-enabled/pickup.conf
Read the simulated unit result first. It says the hypothetical manager loaded the named unit, it is active now and it is disabled under the ordinary unit enablement setting. This combination is possible. It does not tell you which site a hypothetical request selects. Check the enabled link and the record reached through it. Then compare the first text line in the matching root with the default content. The following commands use the most direct inspection for each observation.
cat -- ./unit-example.txt
ls -ld -- ./sites-enabled/pickup.conf
readlink ./sites-enabled/pickup.conf
cat -- ./sites-enabled/pickup.conf
head -n 1 ./roots/default/index.html
head -n 1 ./roots/pickup/index.html
The readlink command prints the path stored in the link. Here it is relative to the directory containing the link. Reading the link as a file with cat follows it to the selected text record. That record identifies the pickup directory in our model. The last two commands show different markers. You can now explain why the presence of an existing default directory is compatible with another selected site root. This is a conclusion about the prepared model. On the real system, confirm the include actually matches that link, the running service loaded it and a request selects the intended site.
Work through a counterexample by reasoning before touching a file. If the enabled link pointed to the default record instead, what marker would the corresponding root contain? The named record found through the link would differ even though both directories and both available files are still present. A real deployment can have both sites active. Then the request's authority and listener selection decide which one answers. Our model keeps only one link in the selected set to show one part of the path. The next evidence for a live case is the actual requested site's configuration and response.
In your note distinguish the access command's result from a status page. You can read a record under your own login. It does not establish that a service worker could read the root page. In the live system check its effective identity and directory traversal rules as appropriate. A managed worker might run with a restricted view of a filesystem. Application behavior can also pass through a proxy and read something from another process. Your inventory should identify the path that belongs to the request and which layer could still change the result.
Finish by checking your current directory and inspecting the exact link and file names. The cleanup names all the worksheet entries and asks before removing them. Removing the link by this name does not require removing another folder. The model's available files are removed separately from the enabled link. If you want to keep your results, save your inventory note elsewhere first.
pwd
ls -la -- ./sites-available ./sites-enabled ./roots/default ./roots/pickup
if [ -n "$inventory_lab" ] && [ "$(pwd -P)" = "$(cd -- "$inventory_lab" && pwd -P)" ]; then
rm -i -- ./sites-enabled/pickup.conf ./sites-available/default.conf ./sites-available/pickup.conf \
./roots/default/index.html ./roots/pickup/index.html ./unit-example.txt &&
rmdir -- ./sites-enabled ./sites-available ./roots/default ./roots/pickup ./roots &&
cd -- "$HOME" &&
rmdir -- "$inventory_lab"
fi
Answer the prompts only for the sample names you have verified. If there is a surprise file, the directory will not be empty and the removal will stop. Compare the remaining files with the initial inventory. Be deliberate about which additional data you want to keep or clear. This is a useful lesson even with a simulation. You can have a completely accurate source list and still need to observe the current state just before making a change.
Use the mismatch to identify which layer to check
Imagine that a student on Amazon Linux 2023 asks why apache2.service is missing. First verify the distribution and installed package. If the packaged web server is Apache, the expected unit is usually httpd.service on that distribution. The missing Ubuntu-style unit name can be completely normal. If the expected unit is also missing, check the installed package and the actual startup context. Installing another web server or creating a service symlink would be a separate administrative decision. Start with the appropriate lookup.
Consider a different problem. A student sees welcome content, while the host is supposed to serve the dairy's timetable. That can mean that a default site answered the requested authority, or that the correct site still has the default root or index content. Identify the hostname and destination listener first. Then compare the selected site and expected content under that root. Use the access log for the intended site or another approved evidence source to confirm which route answered. A public proxy or cache could also be serving an older result. Compare the two request contexts rather than assuming they reach the same handler.
A local working response alongside a public failure is a different mismatch. The expected listener has answered something on the host. The path from an outside client can include additional network and TLS rules. For an EC2 exercise, a security group and a host firewall are distinct controls. CentOS Stream environments can also enforce SELinux decisions about filesystem access independent of ordinary mode bits. Ubuntu can use its configured firewall or security policies. Check the relevant controls and distinguish a network connection failure from an HTTP refusal.
Finally, review a mismatch in configuration validation. A test can use the right binary and a file on disk without taking effect in an already running process. If a service reports a previous load, see which revision the owner authorized and whether the appropriate reload happened. Inspect a scoped response to learn what is effectively active. The package reference gives you likely entrances to the configuration. The running service and request give you the observed state. This separates an incorrect path from an incomplete deployment step.
Write a record that survives a handover
An inventory is useful when another learner can repeat one check without needing every command you typed. Give each observation a scope and a timestamp where relevant. “Ubuntu 24.04 on the assigned instance, Apache package present, unit loaded and active, pickup site served by the configured route” provides a starting chain. Add the actual known path or unit and one content marker. If you did not confirm a data point, write which piece you still need. A pasted package manifest cannot substitute for the chosen route. A hostname and response without the destination context can miss why another trainee gets a different answer.
Use a check from each layer when you change a learning environment. After changing to a different base image, verify the release and installed package. Reconfirm available configuration and service paths. Then verify the named site and listener. After changing only the document path of an existing site, the package and unit might not change. The named response and file access checks become more important. This approach avoids repeating a long system-wide inventory when only one piece changed. It also avoids assuming that unrelated layers were affected by the same action.
Consider a shared instance. Several virtual hosts can exist in the same server configuration and one unit can control them all. A package command or service restart can affect more than the one site in your exercise. Read only the evidence you need for the intended site and use independent practice paths for changes. If you report a table of commonly supplied logs, distinguish it from which access and error logs are configured for the particular host. Some logs can contain request details the recipient does not need. A narrow observation tells them what happened and avoids passing around unrelated routes or settings.
To finish the inventory, write one specific question that remains after your observations. For an active unit that returns the wrong body, ask which site or handler matched. For an installed unit that is failed, ask which diagnostic explains startup. For a local working listener and failing public URL, ask where the public path diverges. Each question names the stage supported by your existing evidence. The reference table then functions as a map for finding the next observation rather than as a set of commands to run blindly.
Try an inventory exchange with another learner. Give them only the release, package, unit and intended hostname. Ask them to identify which fields they can infer from a default reference and which fields still require observation. Then give them the selected site's configuration path and expected marker. Ask what result would establish the actual document root. The routine makes uncertainty explicit. A package table can give a good starting point and still leave room for an administrator's changes. A teammate should be able to tell exactly which value came from a published reference and which value you measured.
Look at the service's unit path and which file documented its launch. Distribution-installed definitions are often under a system library directory. Local overrides can live under an administrator-managed system directory. An update to a packaged unit file can replace a direct edit, which is one reason to use documented override mechanisms for authorized changes. If the manager reports a drop-in, inspect only the relevant official settings in the approved context. For this inventory, leave the paths as observations. Learning which definitions are effective is useful before learning how to change them.
Finally, record the use of the log. An access log entry can show that a request reached a particular handler and which result was returned, depending on the configured format. An error log can explain a failed open, configuration parse or upstream connection. Neither needs to live at one universal path. Keep the site, time and request scope attached when explaining an observed result. If a container forwards logs into its runtime, use that runtime's authorized view. The next learner can then verify a new result even when the host layout differs.
Interview questions with worked answers
How do you choose between httpd and apache2 when checking an Apache service?
I identify the distribution, release and installed package. Ubuntu commonly uses the apache2 package and unit. The RPM-family examples use httpd. I verify the actual unit source or startup method, then request its state. Choosing the wrong conventional name can produce a missing unit while the web process is working.
Why can a service be running while its unit is disabled?
Running is an observation about the current manager state. Enablement concerns the unit's normal activation through its install rules. A manual start or another dependency can start a disabled unit. I read both properties and check the actual request before concluding anything about the website.
How do you find the web root used for one customer request?
Check the destination listener and hostname, identify the selected site and path handler, and read the root or mapping under that context. The package's default root may belong to another site. Compare one known response to the expected content under the selected mapping.
Why might a configuration file in sites-available have no effect?
The main configuration usually includes a selected enabled set, and the file must actually be included. Even an enabled file needs to be loaded by the running service. Also confirm that the request selects that site. Each provides a distinct test for the reported behavior.
What does a named package-file list prove?
It tells me which paths the package database associates with that package. It can locate a supplied unit or configuration. It does not prove the running process opened that file or which website uses it. I attach package evidence to the loaded configuration and the exact response.
Check your understanding
1. A CentOS Stream service is enabled but failed to bind its listener. Which observation matters next?
A. Which process already owns the expected address and port
B. Which directory has the shortest name
C. Which text editor is installed
Answer and reasoning
A. Inspect the current socket and ownership within the assigned scope. Enablement does not confirm it could start.
2. Which result distinguishes active state from boot activation in systemd?
A. A list of all files in the home directory
B. Reporting both the current unit state and enablement state
C. Asking for a package version alone
Answer and reasoning
B. These properties answer separate questions. Either can differ from the status of a particular HTTP path.
3. You found a default HTML directory in a package list. What verifies the named site's root?
A. The distribution's major version alone
B. The default directory's existence
C. The selected site's effective root mapping and an exact content request
Answer and reasoning
C. Site settings and request context can select another path than the packaged default.
4. The shell finds nginx but an RPM package query reports absent. What is a reasonable next check?
A. Identify the resolved executable and actual installation source.
B. Assume the shell output came from Ubuntu.
C. Restart the node immediately.
Answer and reasoning
A. A differently installed or locally provided command can appear in the shell while that package record is absent.
5. What does a local successful response leave to verify for a public URL?
A. Nothing, because every client reaches the same listener.
B. The public hostname, network, TLS and intended request path.
C. Only the operating system release.
Answer and reasoning
B. The public request can traverse different infrastructure and select different routing. Confirm the actual expected route and content.
Revision cards
Identify the actual system
Read its release and confirm where the shell is. Package and service names depend on the installed distribution and context.
Package, command and unit
Record the installed package, executable and manager unit separately. Verify the source of each observation.
Loaded, active and enabled
Loading a unit, running it now and configuring ordinary boot activation are different things. Inspect their actual states.
Read the include pattern
Know which configuration inputs participate and where enabled files point. Keep backup copies outside interpreted include locations.
Resolve the site's actual paths
Match listener, hostname and route. Verify the document root or upstream and the worker's relevant rights and logs.
Prove the result with one request
Check the intended path and expected content on the actual responder. A syntax check or unit state is another piece of evidence.
Official references
- Amazon Linux 2023 distribution package inventory
- Amazon Linux 2023 DNF and YUM compatibility
- Amazon Linux 2023 Apache installation and paths
- Ubuntu Apache package and configuration layout
- Ubuntu Nginx installation and management
- Ubuntu 22.04 Nginx common package file list
- Ubuntu 24.04 Nginx common package file list
- CentOS Stream 9 packaged Nginx configuration source
- CentOS Stream 9 packaged Apache configuration source
- Systemd unit state and enablement reference
- Nginx configuration check and file arguments
- Apache server invocation and configuration options