|Table of Contents|
Being able to share results with collaborators, colleagues, and clients is a hugely important skill for a bioinformatics programmer to know.
One of the main tools bioinformatics programmers use to share results of their work is via Web sites.
In this exercise, you'll learn how to set up and configure an Apache Web server, which is the first step toward using the Web to share results.
Launch an Atmosphere VM if one is not already running and log in.
Use sudo and find to locate apachectl
Apachectl is an apache control script that starts, stops, and restarts the Apache Web server, which is installed by default on most UNIX systems. The apache program file on UNIX is named httpd, which stands for "httpd daemon." On most UNIX systems, you'll find that httpd resides in /usr/sbin, a directory that contains programs run by the super-user. The apachectl is a shell script "wrapper" for the httpd program.
However, most systems won't launch the Apache web server unless configured to do so. Thus it is likely that the base image but won't start serving Web pages until you launch the server using the apachectl script.
That's apachectl with an el character, not a one.
You may need to execute the find command as root (using sudo) because many files and directories on a Unix system are owned by user "root" and are not readable by ordinary users. The apachectl script may be one of them. To find it, use find.
$ sudo find / -name apachectl
Question: What is the absolute path to your copy of apachectl?
Start your web server using apachectl
To find out what commands apachectl supports, try this:
$ sudo PATH/apachectl
where PATH is the absolute path to the script on your VM.
Start the server using apachectl. If PATH is the absolute path to apachectl, then start the Web server like so:
$ sudo PATH/apachectl start
Visit your VM's default home page.
- Check that the Web server has started by entering your VM's IP address in your browser
- visit http://ipaddress, where ipaddress is the IP address of your VM
- Post a link to your VM's URL on the class yahoo group.
Make it your own - publish a Web page
- Create a Web page introducing yourself and copy it onto your VM in the Apache document root directory.
The document root is the directory on your server's file system where Web pages are stored; its location is specified in file httpd.conf, the configuration file that configures how the server will run. Probably your document root will be located in /var/www/html.
To confirm the document root location, find httpd.conf and then search through the file for the text DocumentRoot.
To create your Web page, log into your VM and cd in to the DocumentRoot. Use sudo to launch an editor, such as nano, which is probably installed. Create a file called index.html and save it in your DocumentRoot. If users don't specify a file in the URL, the Web server will send them a file called index.html, if it exists. Here's an example index.html file, written HTML (hypertext markup language), the language of the Web.
<!DOCTYPE html> <html> <body> <h1>Hello! Welcome to my Web site</h1> <p> Here is a very simple example. </p> </body> </html>
To find out more about how to create and edit Web pages, do this tutorial on HTML - http://www.w3schools.com/html/default.asp.
- Start the Web server on your iPlant VM - 1/3 credit
- Publish a Web page on your iPlant VM Web server - 1/3 credit
- Customize the Web page - 1/3 credit
To receive full credit, post a link to the Web page you created to the class newsgroup.
Follow-up - Learn more about Apache
Apache is one of the most robust, well-documented, and versatile software programs in existence. It is an essential tool in bioinformatics programming because much of what we do involves creating and sharing results with collaborators, the public, and so on. Learning how to configure and manage Apache servers and Web sites is well worth the investment of your time and energy. If you'd like to dig a little deeper (and have time!) check out some of the following links:
- 9 Tips to Use Apachectl and Httpd like Power User - http://www.thegeekstuff.com/2008/08/9-tips-to-use-apachectl-and-httpd-like-a-power-user/
- Welcome! - The Apache HTTP Server Project - http://httpd.apache.org/
- apachectl - Apache HTTP Server Control Interface - http://httpd.apache.org/docs/2.4/programs/apachectl.html