Apache
Apache
Deploying and configuring the Apache Web server in a Bioinformatics laboratory.
Contents
Introductory reading
Contents
Installation notes
Installation notes (status: 2007).
Apache is an open-source Web server, with a very high level of community support and the tool of choice for most situations.
- Download
- 1. navigate to the Apache HTTP server download page. Find the link to the appropriate download package for the recomended current realease (2.2.8 as of this writing).
- 2. open a terminal session, navigate to your download directory and type the usual (remember to use the tab key for filename completion :-):
gunzip httpd-2.2.8.tar.gz tar -xvf httpd-2.2.8.tar cd httpd-2.2.8
- Compile
Simply type
<bash> $ ./configure </bash>
Configure then runs pages of analyses that determine how to setup the Makefile. Next, type <bash> $ make $ sudo make install $ make clean </bash>
That's it.
- Test
After installing the software you need to start the httpd daemon. This does not happen automatically. The daemon is the actual Web-server: it will keep on running in the background, listen to incoming requests and respond appropriately. Type:
<bash> $ sudo /usr/local/apache2/bin/apachectl start </bash>
then open a Web browser and type the following into the URL field:
<text> http://localhost/ </text>
The browser should then display the text:
It works!
That should be all. If you don't need the server running, you can always type:
<bash> $ sudo /usr/local/apache2/bin/apachectl stop
- on Ubuntu/Debian systems apache is configured by default to start when the OS starts. The following commands can be used:
sudo /etc/init.d/apache2 stop sudo /etc/init.d/apache2 start sudo /etc/init.d/apache2 restart (useful when checking if configuration edits have taken effect) </bash>
Exercises
Task:
Serve a local file to your browser.
Solution: serving a local file
Serving the local file ~/example.html via the web server.
- Make sure your apache Web server is installed and running.
- Create a subdirectory under your http root directory and copy your example file into that directory. For example in a standard installation, you would type:
$ cd /usr/local/apache2/htdocs
$ mkdir test
$ cp ~/example.html test- Finally, type the URL into your browser: you can either use the IP address or name of your machine (you can get that by typing
ifconfig) or you can serve the file locally using the IP address 127.0.0.1 (think about what the difference is between the two options.)
Thus the URL could be something like:
http://127.0.0.1/test/example.html
Further reading and resources