Appendix F: Apache as BackendΒΆ

  • Install Apache. We will use it as backend.
  • All commands are executed as root user

To install Apache in Ubuntu or Debian, type the command:

$ apt-get install apache2

For CentOS, RHEL or Fedora:

$ yum install httpd

curl is the tool typically used to transfer data from or to a server, but you might want to use something else, like HTTPie, which has a very pretty color printing in the terminal. To install HTTPie in Ubuntu or Debian:

$ apt-get install httpie


  1. Verify that Apache works by typing http -h localhost. You should see a 200 OK response from Apache.

  2. Change Apache’s port from 80 to 8080. In Ubuntu or Debian, you do this in /etc/apache2/ports.conf and /etc/apache2/sites-enabled/000-default.conf. In CentOS, RHEL or Fedora, edit /etc/httpd/conf/httpd.conf.

  3. Restart Apache. In Ubuntu or Debian type service apache2 restart. In CentOS, RHEL or Fedora:

    $ systemctl enable httpd.service
    $ apachectl start
  4. Verify that Apache listens on port 8080:

    http -h localhost:8080