With Ubuntu installing is very straightforward,
sudo apt-get install apache2
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,
ip address 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000 link/ether 40:40:39:1b:ec:30 brd ff:ff:ff:ff:ff:ff inet 126.96.36.199/24 brd 188.8.131.52 scope global eth0 inet6 fe80::4240:39ff:fe1b:ec30/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000 link/ether 40:40:33:6c:9d:19 brd ff:ff:ff:ff:ff:ff inet 10.179.62.235/19 brd 10.179.63.255 scope global eth1 inet6 fe80::4240:33ff:fe6c:9d19/64 scope link valid_lft forever preferred_lft forever
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 184.108.40.206.
Launch a browser and enter your ip address into the browser.
You should see a default Apache webpage.
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,
sudo service apache2 stop sudo service apache2 start sudo service apache2 restart # restart will restart the service (safer, as not all services support reload) sudo service apache2 reload # reload will re-load the configuration files, with little or no downtime. Not all services support it (source: http://askubuntu.com/questions/105200/what-is-the-difference-between-service-restart-and-service-reload)
sudo /etc/init.d/apache2 stop sudo /etc/init.d/apache2 start sudo /etc/init.d/apache2 restart sudo /etc/init.d/apache2 reload
This is now corrected as part of Apache 2.4.18 and onwards.
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,
# create the configuration file in the "available" section echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/servername.conf # enable it by creating a symlink to it from the "enabled" section sudo a2enconf servername
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,
sudo service apache2 restart
.. 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/