Chapter 7: Static Website Hosting (3 OSes × 2 Web Servers)
Practice Questions and Lab Exercises
Come on, practice time! Host your site on at least two combinations – once with Nginx, once with Apache – and the difference will stay with you for good.
चला, आता प्रॅक्टिस! कमीत कमी दोन कॉम्बिनेशन्सवर तुमची साइट होस्ट करा – एकदा Nginx, एकदा Apache – मग फरक कायमचा लक्षात राहील.
चलो, अब प्रैक्टिस! कम से कम दो कॉम्बिनेशन्स पर अपनी साइट होस्ट करो – एक बार Nginx, एक बार Apache – फिर फ़र्क हमेशा के लिए याद रहेगा.
- What is a static website? Give three examples.
- For the six combinations, record common configuration paths and how you would verify the actual root, loaded site definitions and worker user.
- Why do we run
restoreconon CentOS? What happens to SELinux labels when files are moved withmv? - Draft an Nginx server block and an Apache virtual host for the test name
arts-club.example.testwith its own approved public root. - A site gives 403 Forbidden. List four possible causes and how you would check each.
- Lab: Publish the approved public release to assigned Ubuntu with Nginx, or compare the isolated local fixture with Apache.
- Lab: On assigned CentOS Stream 9 with Apache, compare the actual and expected contexts for one sample file and test the named response. Use the supplied evidence cases when an enforcing guest is unavailable.
- Lab: Check two named sites through the same approved listener. Record distinct body markers and the intended fallback. Use
curl --resolvefor a temporary destination mapping.
Quick Revision
- A static file response uses prepared bytes. Start with the selected root and the site’s index and routing rules.
- Stage approved files, select a scoped document root and appropriate access, validate the site configuration, activate it and test the named response and assets.
- Nginx:
conf.d/*.conf(AL/CentOS) orsites-available+ symlink (Ubuntu). Apache:conf.d/*.conf(AL/CentOS) ora2ensite(Ubuntu). - On CentOS, compare current and expected labels. Inspect the relevant firewall zone if the approved outside route needs it.
- Troubleshoot with a named GET, response status and marker, listener and configured log evidence. Compare cloud or firewall rules when the specific path calls for it.
- Next: Chapter 8 explains every config line (root, ports, vhosts); Chapter 9 gives the site a real domain.
Got it? Files, folder, config, permissions and activation. Check the named response with its status and marker, then review the config files line by line.
समजलं का? फाइल्स, फोल्डर, कॉन्फिग, परमिशन्स आणि activation तपासा. Site च्या hostname ने response चा status आणि ओळखता येणारी ओळ पहा. आता पुढे कॉन्फिग फाइल्स लाइन बाय लाइन समजून घेऊ.
समझ आया? फ़ाइलें, फ़ोल्डर, कॉन्फ़िग, परमिशन्स और activation जाँचो। Site के hostname से response का status और पहचान वाली पंक्ति देखो। अब आगे कॉन्फ़िग फ़ाइलें लाइन बाय लाइन समझते हैं।
Build, verify and explain the same static release on two web servers
The college arts club needs a homepage, a schedule page and a stylesheet for its annual rehearsal. The club wants a graceful message when a visitor enters an expired address. Your assignment is to publish the same synthetic release with Apache and Nginx, then compare the resulting HTTP evidence. The public files should be the same in both cases. The configuration syntax, package or runtime wrapper will look different. A good report shows which observations establish consistent behaviour despite those differences.
You can complete the main lab with a private local fixture if you have Python and compatible server executables. The fixture creates its own working directory and loopback listener, so it can run next to existing services. The managed lab is for one or two training guests assigned and authorized by the instructor. Use their distribution-specific setup only when you have that scope. The assessment is about a readable publication and meaningful verification, not the creation of new paid cloud resources or opening a public network rule for practice.
In both approaches record the intended host, port, root, public file paths, status, content type and a distinctive line of the response. You should be able to show a direct comparison for a correct path and a deliberate missing one. Include one controlled mistake, the evidence that located it, the exact update and a passing retest. For a shared service additionally test one authorized existing control to protect other routes from accidental configuration effects.
Write the acceptance requirements before touching the server
Use arts-club.example.test as the local name unless your trainer assigned another name. The suffix is reserved for testing. An HTTP diagnostic command can attach that name to a specific address temporarily, or the local fixture can explicitly send it while connecting to loopback. Give each output file a marker. The homepage should say “Arts club rehearsal desk”, the schedule should say “Rehearsal starts at four”, and the missing page should say “This club page is unavailable”. The stylesheet should contain a rule for .rehearsal. Use a root-relative reference in this example because the exercise publishes at the test host root.
| Path at the assigned test host | Expected outcome | Supporting detail |
|---|---|---|
/ | 200 with HTML | Homepage marker selected through the configured index. |
/schedule.html | 200 with HTML | The expected time from the approved release. |
/css/club.css | 200 with CSS | A rule that appears in the reviewed stylesheet. |
/expired-rehearsal | 404 with HTML | The unavailable-page marker and genuine missing status. |
| Control route when required | The original recorded policy | Compare unmatched or approved existing named content independently. |
The missing path must be absent from the release tree. An HTML body with friendly text does not by itself establish a missing response. The stylesheet check should assert a real CSS media type rather than checking any successful body. In a real event some readers may still have an older asset. That is another delivery concern to test through the approved client. For this exercise compare fresh direct requests on each server so the results describe the prepared release.
Write an error you expect to observe in the practice environment before introducing it. Removing one disposable CSS file from a temporary unpublished candidate can demonstrate an incomplete deployment while retaining a working index. Do not manufacture a failure by changing production network controls or required existing site configuration. Restore the file from the reviewed stage and verify the same CSS URL. Write down why the same normal homepage status did not catch that missing dependency.
Lab one. Prepare the reviewed publication set
You need a writable local scratch folder and a text editor. The following commands create the small public set using Python. They deliberately create a new directory under the platform's temporary location rather than writing to an existing folder. Record the printed path. Open its files with an editor and inspect the relative URLs, case and media types relevant to the acceptance matrix. If you already have an approved release you can compare it with this small synthetic set without overwriting it.
python3 - <<'PY'
from pathlib import Path
from tempfile import mkdtemp
root = Path(mkdtemp(prefix="arts-club-stage-"))
(root / "css").mkdir()
pages = {
"index.html": ("Arts club rehearsal desk",
'<a href="/schedule.html">See the schedule</a>'),
"schedule.html": ("Rehearsal starts at four", ""),
"404.html": ("This club page is unavailable", ""),
}
for name, (title, after) in pages.items():
(root / name).write_text(
'<!doctype html><html lang="en"><meta charset="utf-8">'
f'<title>{title}</title>'
'<link rel="stylesheet" href="/css/club.css">'
f'<h1 class="rehearsal">{title}</h1>{after}</html>\n',
encoding="utf-8",
)
(root / "css/club.css").write_text(".rehearsal { color: indigo; }\n")
print(root)
for item in sorted(root.rglob("*")):
if item.is_file():
print(item.relative_to(root))
PY
Expect exactly the three HTML filenames and one stylesheet relative to the printed root. Note that css is a directory and the individual file has its real extension. Make an explicit manifest rather than relying on what a graphical shell happens to show. A dot-prefixed file, archive or version history is inappropriate under a small public sample unless it was deliberately included. A staging directory can be inspected and copied according to the publisher's rules. The running website directory is a separate destination.
Open a local HTTP preview using Python if you want to see these files together before serving them with your chosen engines. Run from the exact printed stage directory with python3 -m http.server 18798 --bind 127.0.0.1. Visit the loopback port in a separate terminal or browser. Test homepage and linked schedule, then the CSS response. This preview uses Python's own error response, so the custom 404 acceptance remains to be tested under the two server configs. Exit the temporary process in its own terminal. Keep the stage for the comparison below and remove only that temporary directory after completing both runs.
Lab two. Run the same acceptance matrix on either local engine
Prerequisites are Python 3, the absolute stage path created above, and an approved executable for Nginx or Apache 2.4. Run without sudo. Set CLUB_STAGE to the exact stage path. Choose CLUB_ENGINE=nginx or CLUB_ENGINE=apache. If the executable is outside your path, set CLUB_BINARY to its approved absolute location. For an Apache build with a special layout set CLUB_MODULES to its matching module directory. The script builds new isolated server files for each run. Choose another engine and repeat to compare its outcomes.
export CLUB_STAGE='REPLACE_WITH_PRINTED_STAGE_PATH'
export CLUB_ENGINE='nginx'
# Or set CLUB_ENGINE=apache for the second run.
python3 - <<'PY'
from http.client import HTTPConnection
from pathlib import Path
from tempfile import TemporaryDirectory
import os
import shutil
import socket
import subprocess
import time
engine = os.environ.get("CLUB_ENGINE", "nginx")
source = Path(os.environ["CLUB_STAGE"]).resolve(strict=True)
if engine not in ("nginx", "apache") or os.getuid() == 0:
raise SystemExit("Choose an engine and use an ordinary shell.")
paths = ("index.html", "schedule.html", "404.html", "css/club.css")
for name in paths:
p = source / name
if not p.is_file() or p.is_symlink() or p.resolve().parent != p.parent:
raise SystemExit(f"Inspect the regular release path first: {name}")
binary = os.environ.get("CLUB_BINARY")
if not binary:
binary = (shutil.which("nginx") if engine == "nginx"
else shutil.which("httpd") or shutil.which("apache2"))
if not binary:
raise SystemExit(f"An approved executable is needed for {engine}.")
with TemporaryDirectory(prefix="arts-club-server-") as tmp:
base = Path(tmp).resolve()
public = base / "public"
(public / "css").mkdir(parents=True)
for name in paths:
shutil.copyfile(source / name, public / name)
with socket.socket() as probe:
probe.bind(("127.0.0.1", 0))
port = probe.getsockname()[1]
site = "arts-club.example.test"
config = base / "server.conf"
if engine == "nginx":
paths = ("client_body", "proxy", "fastcgi", "uwsgi", "scgi")
scratch = "\n".join(f'{name}_temp_path "{base / name}";' for name in paths)
config.write_text(f"""
pid "{base / 'pid'}";
error_log "{base / 'errors'}";
events {{ worker_connections 20; }}
http {{
{scratch}
types {{ text/html html; text/css css; }}
access_log "{base / 'access'}";
server {{
listen 127.0.0.1:{port};
server_name {site};
root "{public}";
index index.html;
location / {{ try_files $uri $uri/ =404; }}
error_page 404 /404.html;
}}
}}
""")
args = [binary, "-e", "stderr", "-p", str(base) + "/", "-c", str(config)]
foreground = ["-g", "daemon off;"]
else:
locations = ("/usr/libexec/apache2", "/usr/lib/apache2/modules",
"/usr/lib64/httpd/modules")
module_dir = os.environ.get("CLUB_MODULES") or next(
(p for p in locations if Path(p, "mod_mpm_event.so").is_file()), "")
if not module_dir:
raise SystemExit("Supply the directory of modules matching Apache.")
builtins = subprocess.run([binary, "-l"], text=True, capture_output=True,
check=True).stdout
modules = []
for name in ("mpm_event", "unixd", "authz_core", "mime", "dir", "log_config"):
if f"mod_{name}.c" not in builtins:
p = Path(module_dir) / f"mod_{name}.so"
if not p.is_file():
raise SystemExit(f"Missing matching module: {p}")
modules.append(f'LoadModule {name}_module "{p}"')
(base / "types").write_text("text/html html\ntext/css css\n")
config.write_text("\n".join(modules) + f"""
ServerRoot "{base}"
DefaultRuntimeDir "{base}"
PidFile "{base / 'pid'}"
Listen 127.0.0.1:{port}
ServerName {site}
ErrorLog "{base / 'errors'}"
TypesConfig "{base / 'types'}"
<VirtualHost 127.0.0.1:{port}>
ServerName {site}
DocumentRoot "{public}"
<Directory "{public}">
Options None
AllowOverride None
Require all granted
DirectoryIndex index.html
</Directory>
ErrorDocument 404 /404.html
CustomLog "{base / 'access'}" "%r %>s"
</VirtualHost>
""")
args = [binary, "-f", str(config)]
foreground = ["-DFOREGROUND"]
subprocess.run([*args, "-t"], check=True)
process = subprocess.Popen([*args, *foreground])
try:
for _ in range(60):
if process.poll() is not None:
raise RuntimeError("Private server stopped during startup.")
with socket.socket() as test:
if not test.connect_ex(("127.0.0.1", port)):
break
time.sleep(0.05)
else:
raise RuntimeError("No local listener.")
def get(uri, status, kind, marker):
connection = HTTPConnection("127.0.0.1", port, timeout=3)
try:
connection.request("GET", uri, headers={"Host": site})
response = connection.getresponse()
body = response.read().decode()
assert response.status == status, (uri, response.status)
assert response.getheader("content-type").startswith(kind), uri
assert marker in body, uri
print(f"{engine} {uri}: {status} {kind}")
finally:
connection.close()
expected = (
("/", 200, "text/html", "Arts club rehearsal desk"),
("/schedule.html", 200, "text/html", "Rehearsal starts at four"),
("/css/club.css", 200, "text/css", ".rehearsal"),
("/expired-rehearsal", 404, "text/html", "This club page is unavailable"),
)
for row in expected:
get(*row)
(public / "css/club.css").unlink()
get(*expected[0])
get("/css/club.css", 404, "text/html", "This club page is unavailable")
shutil.copyfile(source / "css/club.css", public / "css/club.css")
get(*expected[2])
assert "GET /expired-rehearsal HTTP/1.1" in (base / "access").read_text()
finally:
process.terminate()
try:
process.wait(timeout=6)
except subprocess.TimeoutExpired:
process.kill()
process.wait()
PY
The first four results match the acceptance matrix. Then the homepage remains 200 while the stylesheet gives its own 404 after removing only the scratch copy. Restoring its approved bytes returns the stylesheet to 200. The script uses one private listener and one service at a time. It verifies the named request, approved markers and content types, and the missing request appears in the fixture's log. No system service is started or stopped. Only the copied temporary publish tree is changed. The separate stage remains available for the other run.
If a module is missing or the temporary port is claimed before the process starts, read the error and check your selected executable and loader paths. A build with fewer modules may require a different test setup. Choose an approved supported variant rather than changing a running host service. If an assertion says the body is wrong, compare the exact files in CLUB_STAGE with the initial markers. The fixture copies only the four approved regular paths. After testing both engines, stop any preview still running and delete the exact stage directory you created for the exercise.
Explain the equivalent behaviour in the two configurations
Study the configuration strings before running them. Both create one socket on the same machine's loopback interface and bind to an unused high port. Nginx places its listen directive in the server block and its event settings outside the HTTP site definition. Apache's Listen directive opens the socket separately, and the VirtualHost specifies which connections can use the site. Both attach the intended name to a particular public directory. That is the mechanism you should explain in your output comparison.
Notice the file lookup rules. Nginx's root value supplies a base for normal requests. The example checks a file or directory, then uses the missing status when the path does not exist. Apache uses its DocumentRoot and the configured directory index and authorization. Both can serve a particular local body for a missing URL, but their directive names and contexts differ. Read the expected body and status after activation. Putting an error message into a file only enables this behaviour once the chosen site configuration points to that file correctly.
Test outputs do not have to match byte for byte in their headers. The engines can send different server fields, dates or response metadata. The exercise requirements concern the selected content and status, required media types and the scope of the change. If the collection deadline is four o'clock, compare the exact schedule text and path. When using a checksum for immutable files, compare the expected content bytes rather than assuming the full HTTP exchange will be identical. Make the acceptance assertions reflect what the public experience actually needs.
The named test asks these fixtures for one approved site. With only that single site eligible, unmatched traffic can also select it by default. If your assessment needs to prove that different hostnames select different roots, add the separate default and second named site from the virtual-host exercise or use its full loopback matrix. Do not claim the one-site fixture established independent multi-site routing. State what each response check can demonstrate and which configuration or deployment case needs different proof.
Lab three. Publish to an approved managed guest and keep the starting state
You need a dedicated assigned Linux guest, authorized administrative access, a reviewed release directory, and a recorded connection plan. Choose one web server and identify the correct operating system row from earlier lessons. You can compare Ubuntu with a CentOS or Amazon Linux guest if the instructor provides both. You can also compare the managed guest with one of your prior local engine runs. On a machine with an existing service at the planned port, use the isolated fixture for comparison. Changing that process or its startup state is outside the assignment.
cat /etc/os-release
id
sudo ss -ltnp 'sport = :80'
systemctl is-active nginx
systemctl is-active apache2
systemctl is-active httpd
Run the relevant unit check for the guest and record the actual identity and port owner. A missing or inactive unit before setup can be expected. The file containing the guest identity is independent of the EC2 username or the path of the key. If working from a remote terminal, confirm the assigned instance before uploading. Use the site's approved method to authenticate and verify the host. A dropped connection after a file upload needs a destination manifest and checksum comparison rather than an assumption that the entire transfer completed.
Transfer the four reviewed public files into the designated private stage. Compare their relative paths and bytes. Inspect the eventual public root for any existing content before choosing a new owned location and plan. Do not publish every file from a repository just because it builds locally.
Install the approved release into its own directory with the publisher's file and directory permissions. Check the worker's ability to traverse the path. On a labelled guest compare the expected and actual SELinux contexts for this release. A scope-specific context rule is only needed when the intended path does not already have an appropriate mapping.
Stage a new named definition using the appropriate example for the installed service. Check the exact loaded include or enable the new site through the distro's mechanism. Do not change the existing default to make a hostname test work. Validate the full disk configuration and read warnings, then start or reload only the assigned service.
Use the matrix's four named requests through the intended local listener. Confirm the expected status, media type and body markers. For a shared approved setup also compare the original control, such as a known unmatched request, and confirm any existing named control did not change.
If your assignment includes a permitted outside client, repeat the relevant named verification with its actual approved route. Ask what network scope is needed before making any change. Record the route so you can tell a local pass from a public or private delivery pass.
In your answer note the package and service choice. Ubuntu commonly uses apache2 for its Apache unit, whereas the RPM-based lessons use httpd. Nginx uses its own unit and configuration. On an Ubuntu link-based setup you can verify the available definition and enabled entry separately. An RPM include can read directly from its scoped directory. These are packaging conventions, so verify the actual state on the guest. The effective site name and path should be discoverable in the parsed mapping before the request.
# Example for the assigned HTTP lab with a loopback listener on port 80.
SITE='arts-club.example.test'
for url_path in / /schedule.html /css/club.css /expired-rehearsal; do
curl --noproxy '*' --resolve "$SITE:80:127.0.0.1" \
--silent --show-error --max-time 5 --include \
"http://$SITE$url_path"
done
Look for a control and a fault among the results. A wrong body with status 200 can select an existing default. An asset 404 from the correct site could point to a missing file or incorrect relative path. A whole local connection failure points to service and socket evidence first. Check how the assigned daemon handles its site logs and review only the relevant lines. Observe whether the required status and body belong to the correct server. Then make one approved correction, record it and repeat the full affected path and selected control.
Do not assume the two managed machines need the same firewall or certificate state. If both are classroom-only guests, they may intentionally only allow a permitted private client. If you use a recognized public name and need HTTPS, the certificate setup, validation, active endpoint and renewal are a separate lab. A verified HTTP file response does not supply those credentials. Write down which routes and schemes the overall assignment actually included. The local-only outcome remains a valid result for comparing two engines.
At cleanup remove only the configuration, link, public files and optional network exceptions created for the exercise, in the order the owner approves. Keep required logs or checksums outside any disposable instance. Verify the unchanged controls after restoring the previous configuration and before deleting its temporary public tree. A separately allocated resource has its own lifecycle. Check the instructor's inventory rather than assuming that stopping a service automatically retires addresses or storage.
Lab four. Diagnose a scope-specific mistake with supplied observations
Use the synthetic cases in this section as a troubleshooting exercise when you do not have permission to simulate faults on a cloud service. Draw a short three-column worksheet labelled observation, evidence needed and intended repair. For each case predict the first failed decision, then compare with the worked notes below. The cases share the arts club release but deliberately vary one condition. They help you avoid applying all the configuration commands as though every error had the same cause.
| Observation | Working control | Record before choosing a fix |
|---|---|---|
| Correct homepage marker; stylesheet response is 404. | The approved nested schedule page is 200 through the same hostname. | The actual asset URL, media type and mapped release directory. |
| Named request shows an old welcome page; candidate passes syntax check. | The package's unmatched request still shows the expected welcome body. | The included site file and name, activation results and actual request host. |
| Correct marked page in loopback; permitted outside client cannot connect. | The loopback request reaches the intended site. | Actual client target and scheme, binding, allowed route and relevant firewall state. |
For the stylesheet case, inspect the missing request from the browser. It may be /event/css/club.css from a nested page that linked to css/club.css while the approved release stores CSS in /css. Compare the requested path to the public manifest. Fix only the link that produced the incorrect location and retest its explicit CSS URL. If the link is correct and the file is absent, install the reviewed missing asset through the publisher's process. Both scenarios can yield the same 404, yet the correct fix differs.
For the default case, check the eligible address and port group and the request's host. If a disk configuration shows the new name but it still is not active, read the service activation result and compare which binary and config were tested. If the config test omitted the candidate entirely, examine an incorrect filename or missing enabled link. A successful parsed fallback says little about the new candidate. Do not remove the default to hide the symptom. Check the named response after the exact correction and confirm the fallback stayed available if the lab called for it.
For the outside route case, the local file and vhost already worked in their own path. Start by comparing the outside client's real destination and port with the assignment. If a firewall or security group participates, read the rules for the relevant source, interface or attached resources. An old DNS answer can take the browser elsewhere. A listener could also accept only loopback. Fix only the authorized route or service binding supported by the evidence, then use the same outside client for the next probe. No need to change file permissions to permit a blocked network connection.
This practice uses supplied data only. A passing worksheet gives one comparison capable of disconfirming each first guess. For example, seeing the named block in the full parsed map makes a missing enablement less likely but leaves activation and host selection to check. A successful outside TLS handshake and an HTTP 403 show a route was possible, while the public file or authorization still needs review. The course expects you to reason from results, not only remember the order to run commands.
Lab five. Compare access evidence for a newly published file
Work with the staged four-file project. For the paper exercise suppose that schedule.html is present at the intended public path and has ordinary mode 0644, while an earlier approved homepage already works. The next question is whether the server worker can reach the exact schedule object. In an authorized CentOS lab use the label and path observations below against your own public release. Where policy inspection is unavailable, use the hypothetical records in the worked examples and label your conclusions accordingly. An enforced SELinux check should not be treated as verified on a laptop with an unrelated OS.
ROOT=/var/www/arts-club-lab
namei -l "$ROOT/schedule.html"
ls -ld "$ROOT" "$ROOT/css"
# On the assigned SELinux guest only:
getenforce
ls -Zd "$ROOT" "$ROOT/schedule.html"
matchpathcon "$ROOT/schedule.html"
A file with the right mode can still be under a directory the worker cannot traverse. In this case the path walk can expose the ancestor. Choose a legitimate public root and respect the publishing account's access policy; a private parent directory need not be opened. If both the ordinary path and file read are suitable, compare the actual label with the expected path mapping and read a closely matching audit event after an approved request. Notice which name, process, operation and time match the problem. A recorded denial unrelated to this site does not supply a useful cause.
Work through three hypothetical observations. In the first, the current label for the newly moved schedule is a home type while the expected label is the web content type. Previewing and applying an approved scoped restore can fix that mismatch. In the second, both labels point to an unsuitable type because the new root is outside the configured content mapping. Ask the policy owner to review a narrowly scoped rule. In the third, the schedule is readable and the request still returns 403 only for an existing directory URL. Review the site's index and listing policy before altering any filesystem state.
If a real scoped policy repair is part of your exercise, repeat the same request and verify the approval marker and its status. Do not require an artificial 403 for a correctly configured file. The ordinary successful result and the context verification can be your acceptance evidence. Keep a working homepage as a control, and document whether the candidate file needed any correction. For paper practice no file or policy changes remain. In the managed exercise remove only your temporary guide or independently approved mapping when the site and content no longer need it.
Extend the project to two names when the assignment calls for it
Give the arts club a second site for ticket information. Use a different approved local test name and a distinct root. Put a home and schedule page with a marker for that site, not the rehearsal time. The two definitions can share the listener while selecting different file trees by name. In the local fixture both configured names need eligible blocks before the chosen name can establish independence. Add a deliberate fallback or account for the existing one in the named service. Write down what an unmatched test should return under the selected listener.
For the two-site acceptance start with the exact same URL path on both names. One can describe practice rehearsal and the other can describe audience opening hours. Use two temporary destination overrides to the same socket and check separate content. Repeat one source-controlled copy or file change in only the rehearsal release and verify that the ticket marker remained the same. If both markers change, compare the effective roots before modifying DNS, because the issue may be a shared publish directory. If only the requested name changed, read the new eligibility and fallback rules instead.
Use the result to explain the scope of the change. A publisher can preserve file independence by giving the two sites different planned roots and controlled ownership. Their workers and shared reload still belong to one process when deployed in one daemon. A protected or isolated tenant would need other boundaries and authorization. For this course the intended demonstration is distinct named response, asset and log handling on a common listener. Leave unrelated names and fallback pages unchanged in a managed exercise.
Build a submission someone else can assess
Begin with the chosen setup and the actual scope you ran. State the distribution and service information only for a managed guest you really checked. For a private fixture state the local engine and that you did not test its package service or any outside connectivity. List the approved example names and file markers. Add a simple status matrix for the homepage, schedule, CSS and missing URL. Include one earlier correct file or approved fallback as a control where appropriate.
| Result to demonstrate | Evidence to include | Common incomplete evidence |
|---|---|---|
| Same source release. | Four exact relative paths and matching content digests or byte comparisons. | A screenshot of a folder named after the project. |
| Correct engine setup. | Parsed config and observed actual listener plus expected site name or fixture scope. | A package version without any request or service evidence. |
| All expected resources. | Named requests with HTTP status, media type and expected marker. | Only a successful GET or HEAD on the root URL. |
| Controlled repair. | One failed scoped observation, one resulting change and matching successful response. | Several unrecorded changes followed by a passing page. |
| Rollback and cleanup. | Specific restored state and a test showing the correct surviving service or no scratch listener. | A general statement that the old configuration was backed up. |
When reporting the lab from beginning to end, show a practical sequence. The original correct response identifies a usable baseline. The intentionally removed asset produces 404 with a particular body. The same root still serves the home page. The staged source still contains the stylesheet. After restoring only that approved file, the explicit resource's content type and rule return to their intended values. This sequence explains exactly which operation made the observed change. It rules out several irrelevant alternative changes without requiring you to adjust the scenario.
An application screenshot can help describe the reader's experience, but combine it with request evidence. In a web developer panel the loaded stylesheet appears as a distinct item. Record its exact path with the scheme and host already agreed for the project. On the demo page the file is a small local stylesheet, and its rule directly matches the heading class. You can verify both pieces of information in the returned data even when the colours look different on two displays. The report should let the evaluator repeat it without interpreting an image alone.
Rehearse a scoped rollback before relying on the deployment
A rollback practice works best when you choose the prior accepted state in advance. Keep the staged release and the exact earlier file or configuration. For a file-only update compare the old and new bytes and keep the previous marker. For a vhost or root change keep an approved backup of the altered config with any enabled link detail. Store backups outside both loaded includes and served directories. An entire machine restore is a larger operation and can affect other owners on a shared instance. Practise the specific site rollback needed by your change.
Plan the order aloud. Restore the particular previous root or site definition, run the correct configuration validation if needed, and apply it through the owned service. Repeat the identified page, asset and test missing URI. Compare the prior release marker and any required control site. When the exercise ran in a local harness, let it stop and verify that Python or the daemon exited. The stage is a separate scratch artifact created for both tests. Remove it after its role is complete rather than mistaking it for a server configuration file.
If the site owner's real requirement is public DNS and HTTPS, note how their rollback differs from restoring an asset. DNS changes have cache lifetimes, and replacing a certificate depends on the active TLS endpoint and its stored valid material. Verify those paths through the normal authorized client route. They are separate from local server mapping. A private lab can leave those steps in the written plan and report that it observed file and named HTTP behaviour only. Clear limits make the result more useful than an unsupported claim that deployment is complete.
Try a second release with a changed schedule link
Once both engines pass the first matrix, prepare a new temporary candidate with a renamed rehearsal sheet. Decide whether the former schedule URL should disappear or redirect readers. Write that expectation before editing the new name. Update the link in the staged homepage. A reviewer must be able to request the direct new page as well as follow the navigation. An unchanged index status alone could mask a link still pointing to the retired document. Compare the public path list and the browser request, not the visible link text alone.
For a simpler independent variant, keep the file names and change only the rehearsal time. Write a new expected marker, then compare the files and responses as in the first release. The homepage can retain its original marker while the schedule content is updated. A test that only looks for the previous schedule line should now fail even when the right release was published. Update acceptance requirements explicitly when a requirement changes. Keep the first copy to practise a bounded rollback. Restore that copy to scratch and verify that the old marker returns in both engines.
Identify how the change would differ on an already active vhost. File changes within its existing root can typically be read by a later direct request without replacing the server config. If you intentionally change the root or alias rules, validate and apply that configuration under the planned service. Report which type of change you performed. A fixed port, familiar operating system or reused site name cannot establish which root supplied a live response. Each new run should name the selected release and its intended active path.
Ask a reviewer to repeat the test from the written record
Give a second learner the four URLs and expected outputs without showing them your terminal. If working locally they can read the unprivileged fixture's selected endpoint or reproduce the same test on their machine. They should be able to identify the document and stylesheet from the returned details. Ask them to predict the result of using an unconfigured name and explain whether your actual lab created an independent default or only a single applicable site. This reveals if the report overstates what one hostname can prove.
For a managed private lab, have that learner use the assigned network route instead of inheriting your local address override. Record their actual effective hostname, destination and successful or failed public paths. If logs identify the same named site, the evidence about its routing is stronger than a status alone. If the responses disagree, compare the exact address and request first. One of you may intentionally be using loopback while the other exercises a private route. A written change plan should make such differences visible to the next reviewer.
Conclude by explaining one setting that each web server expresses differently and one behaviour that all sites should verify consistently. For example, Apache configures a separate listening directive while the Nginx sample puts the port inside the selected server rule. Both can read the reviewed schedule and return a useful 404 for a missing URL. This comparison shows command familiarity and the independent goal the commands serve. It also gives a colleague a place to start if a later edit changes one site's behavior unexpectedly.
Interview questions with explained answers
How did you know both engines served the same static release?
Compare the approved file set and use the same expected hostname, resource paths and content markers. The exact response headers can differ, but both should supply the published bytes and intended media types and statuses for the same exercise.
Why did you verify the public folder independently of the transfer?
The successful upload writes to a staging location. The server's effective root decides which directory supplies each request. A byte and path comparison plus the named response shows that the chosen release was published.
Why did the homepage stay successful after the stylesheet was removed?
The document and stylesheet are independent HTTP requests. The first still resolves to a readable file. The second maps to a missing path and receives its own 404. Test dependencies as separate acceptance cases.
Which evidence would trigger a review of CentOS SELinux labels?
A request to the true vhost could have a file access refusal and a matching policy event. Compare ordinary access plus current and expected labels before choosing a scoped restore or asking for a mapping correction.
How would you prove a second site was preserved after activating yours?
Record the authorized control name and marker before the change, validate the whole service configuration and repeat that exact request afterwards. Check the new host independently and include the intended fallback when applicable.
Check your understanding
Which fixture file is intentionally removed after the initial acceptance?
Show answer
The temporary public copy of the stylesheet. Its source remains in the reviewed stage. The homepage should stay available while the CSS URL fails.
Why use the full named request for the managed site?
Show answer
Site selection uses the requested hostname among eligible listener definitions. A raw destination could return a default body that does not prove the new site works.
Can both servers return a similar custom 404 despite different directive names?
Show answer
Yes. The local error mapping mechanisms differ, but the expected HTTP behaviour is the same. Verify 404 together with the intended body and media type.
What do you check if the stage source is correct and the server still shows the old schedule?
Show answer
Compare the actual loaded root, deployed file bytes, named response and cache or delivery path. The stage source alone does not identify the served release.
What does a successful local HTTP comparison establish about public TLS?
Show answer
It confirms the tested local file responses. Public TLS has separate endpoint, identity, chain, routing and renewal requirements.
Independent practice tasks
Compare the Nginx and Apache configs and name the matching choices for listener, hostname, document root, index and error response. Back up the comparison with the four observed requests.
Use the hypothetical access records to distinguish a missing file, denied directory and incorrectly labelled guide. For each, identify the specific evidence you need before choosing a change.
Prepare a rollback note for the managed guest or temporary fixture. State which artifacts belong to the exercise, how the prior state is restored and what request verifies it.
Revision cards
- Stage
- A reviewable input tree, separate from the directory selected by the running site.
- Acceptance matrix
- The hostname, paths, statuses, types and file markers used to compare both engines.
- Control request
- A path or site expected to stay available during the specific correction.
- Scoped fault
- One intentional change in an isolated exercise, with a predicted result and a controlled restore.
- Site configuration
- The loaded listener and name rules, published path and expected error handling for the chosen service.
- Cleanup proof
- Stop the private fixture or restore authorized managed state, then verify the resulting listener and content.
Official sources
- Python local HTTP servers
- Python HTTP client
- Python temporary directories
- Nginx listener and host choice
- Nginx root, try_files and error pages
- Nginx configuration lifecycle
- Apache virtual host matching
- Apache document roots and error documents
- Ubuntu Apache site enablement
- Ubuntu Nginx site definitions
- SELinux access evidence
- Linux path traversal
- AWS network access rules
- HTTP response status and meaning
- Reserved DNS testing names
- Curl diagnostics and named destination overrides