From Fedora Project Wiki
Description
This test case ensures that the httpd (Apache HTTP Server) is installed correctly, starts properly, serves content, and can be managed through systemd.
Setup
- Install the
httpdpackage if it is not already installed:sudo dnf install httpd
How to test
- Start the
httpdservice:sudo systemctl start httpd - Enable the
httpdservice to start on boot:sudo systemctl enable httpd - Verify that the
httpdservice is running:sudo systemctl status httpd - Create a simple HTML file to serve:
printf '<html><body><h1>Hello, Fedora!</h1></body></html>\n' | sudo tee /var/www/html/index.html
- Open a web browser and navigate to
http://localhost/to see the served content. - Check the Apache configuration file for errors:
sudo apachectl configtest - Reload the
httpdservice to apply any configuration changes:sudo systemctl reload httpd
Expected Results
- The
httpdpackage should install without errors. - The
httpdservice should start without errors and be enabled to start on boot. - The status command should indicate that
httpdis active and running. - Navigating to
http://localhost/should display "Hello, Fedora!" in the web browser. - The
apachectl configtestcommand should return "Syntax OK". - The
httpdservice should reload without errors.
Optional
For additional testing:
- Configure a virtual host and verify it serves content correctly.
- Enable and test SSL support by generating a self-signed certificate.
- Test serving different types of files (e.g., images, scripts) and using different modules.
