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
Next:
Verify that Apache works by typing
http -h localhost
. You should see a200 OK
response from Apache.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
.Restart Apache. In Ubuntu or Debian type
service apache2 restart
. In CentOS, RHEL or Fedora:$ systemctl enable httpd.service $ apachectl start
Verify that Apache listens on port
8080
:http -h localhost:8080