With Ubuntu installing is very straightforward,
Apache 2.x is now installed.
What about Zero Footprint Apache? Definitely doable, but practically with virtualization, and how rarely Apache actually changes right now I'm leaning towards just scripting configuration files only inside of a container.
Having said that, if time permits I might build a BonsaiFramework version.
Verify that the Apache Web Server is running first by hitting your server's IP Address. If you do not know your ip address, at the console type,
Sometimes you may get back more than one IP address if you have more than one Ethernet card. If you are unsure, just try them one at a time in the next step. In this case mine is 220.127.116.11.
Launch a browser and enter your ip address into the browser.
You should see a default Apache webpage.
Stopping, Starting, Restarting and Reload
You should know the basic commands to running Apache 2. Go ahead and try them. Note ignore the warning message about "fully qualified domain name" as that is covered in the next section.
As of Ubuntu 12, the following the basic commands to manage Apache2 are,
Provide Server Name
This seems to be auotmated somehow with Apache 2.4.18.
Apache is working fine, but during restart you will get the warning message, "apache2: Could not reliably determine the server's fully qualified domain name, using ...".
Most websites have a domain name attached to them. Apache is looking for this on start-up. Depending on the version of Apache and Ubuntu this can be resolved by adding the ServerName Directive with the hostname.
You can determine hostname by typing,
Adding an entry into the Global Configuration ensures that the change will persist even if Apache is upgraded,
This concept has changed over time and look here for legacy versions of Apache.
Restart Apache to confirm you do not get the warning messages,
Apache Basic Server Hardening
Before hardening your Web Server you should make sure it works with it's intended integrated purpose in a test environment. Otherwise you may spend lots of wasted time trouble-shooting.
So, assuming that your Web Server passes testing of it's intended purpose, you may perform "Basic Hardening". Because this is "basic" I often perform these all at once and then test.
Here are some of the basic hardening steps I take today by default,
As with any security notes, I will write a disclaimer that there are more advanced ways to secure Apache. You can go as far as compiling your own custom version but that's out of scope for now.
Disable Server Information Banner
By default Apache provides extra information about your server when 403, 404, 502 or similar error pages are invoked. The information could be used to look up vulnerabilities on the particular version of Apache you are running.
If you visit a page that does not exist you will invoke a 404 error resulting in a page Not Found similar to below,
set ServerTokens Prod - This turns off all the extra header information sent by Apache.
set ServerSignatures Off - Removes footer information from default apache pages. For example, page not found.
Older versions of Apache use /etc/apache2/conf.d/security
Restart Apache to take effect and verify by invoking a 404 again.
Disabling Unnecessary Modules
Less loaded, less vulnerabilities and you will also get performance increases too.
Disable Status Module
I found that you can save about 3MB of memory if the status apache module is disabled. Here's how to disable interactively,
Disable More Modules
Will flush this out some more ...
Turn off Default Website
Uninstall Apache Completely
.. these instructions need to be improved, and there is nothing here about removing logs.
1. stop apache:
sudo service apache2 stop
sudo /etc/init.d/apache2 stop
sudo apt-get remove apache2
sudo apt-get purge apache2
http://cloudservers.mosso.com/index.php/Ubuntu_-_Apache_configuration#Security_Settings - Rackspace wiki on hardening Apache Web Server.
Apache Web Server Hardening Guide - https://geekflare.com/apache-web-server-hardening-security/