Install and set up Apache - ndgriffeth/Class-Notes-and-Lectures GitHub Wiki

MAC OS X

Apache is bundled with Mac OS X, all you need to do is activate it. Instructions for specific versions of Mac OS X follow.

Installing

All versions prior to Mountain Lion

Activate Apache by activating Web Sharing on the Sharing pane in System Preferences. That was easy!

Mountain Lion

You must use the command line to activate Apache:

1. Start a terminal window.

2. Type sudo apachectl start

   You will be prompted for your password, provide it (you have to have administrative privileges).

That was still pretty easy!

Testing (on any Mac OS X version)

Test your installation by browsing to http://localhost/ (shortcut: just type localhost as the URL).

After it has been installed, here are other useful commands from the terminal:

1. httpd -v (display the software version)

2. sudo apachectl stop (stop the apache daemon)

3. sudo apachectl restart (restart the apache daemon -- useful after changing the configuration).

Ubuntu

You will have to work from a Terminal Window.

Just to keep life simple, make yourself the root user (who can do almost anything on a Linux system!):

sudo su

Steps:

1.  Install apache2
    apt-get install apache2

2.  Test your installation by browsing to http://localhost/ (shortcut: just type localhost as the URL).
    You should see a page that says "It works!!"

Windows XP

Links:

The Apache Web Site: http://httpd.apache.org/.

The Site Wizard page for Apache on Windows: http://www.thesitewizard.com/apache/install-apache-2-windows.shtml

Instructions:

1.  Download and run a Windows installation file for Apache2 with OpenSSL, from the Apache Web Site.
    You should use httpd-2.2.25-win32-x86-openssl-0.9.8y.msi, or a later version with OpenSSL.
2.  Follow the instructions in step 2 on the Site Wizard page shown above. 
3.  Start Apache using Start>All Programs>Apache HTTP Server 2.2>Control Apache Server>Start.
4.  Browse to the URL http://localhost/ to test the server.
    You should see a page that says "It works!!"

You can start, stop, and restart Apache using Start>All Programs>Apache HTTP Server 2.2>Control Apache Server.