apache

Getting started with apache

Remarks#

This section provides an overview of what apache is, and why a developer might want to use it.

It should also mention any large subjects within apache, and link out to the related topics. Since the Documentation for apache is new, you may need to create initial versions of those related topics.

Versions#

Various Apache httpd releases

VersionCurrent versionRelease
1.31.3.421998-06-06
2.02.0.652002-04-06
2.22.2.322005-12-01
2.42.4.252012-02-21

Installation or Setup

Detailed instructions on getting apache set up or installed.

Ubuntu Installation


sudo apt-get install apache2

Windows Installation


Check out the WAMP stack. WAMP stands for Windows, Apache, MySQL, PhpMyAdmin.

CentOS Installation


Apache 2.2 comes with CentOS6, whereas 2.4 comes with CentOS7, to install on either OS, run

yum -y install httpd

macOS Installation


macOS comes with Apache pre-installed,however,can install Apache via Homebrew

If you already have the built-in Apache running, it will need to be shutdown first, and any auto-loading scripts removed.

$ sudo apachectl stop
$ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
$ brew install httpd24 --with-privileged-ports --with-http2

[Ubuntu] Simple Hello World Example

This example will guide you through setting up a back end serving an a Hello World HTML page.

Installing Requirements


Order matters for this step!

  • sudo apt-get install apache2

Setting up the HTML


Apache files live in /var/www/html/. Lets quickly get there. Make sure you’re in your root directory first, cd, then cd /var/www/html/.

This html directory is where all your website files will live. Lets quickly make a simple Hello World file.

Using your favorite text editor, type the following in

<!DOCTYPE html>
<html>
<head>
    <title>Hello World!</title>
</head>
<body>
    <h1>Hello World!</h1>
</body>
</html>

Save this file as index.html in the current directory and you’re set to go!

Visiting Your Webpage


To visit the page you just created, in your browser of choice, go to localhost. If that doesn’t work, try 127.0.0.1. You should see “Hello World!” as a h1. You’re done!

To ensure the server is up.

If you get a message that the browser can’t connect to the server, first check to ensure the server is up.

$ ps -aef | grep httpd

You should see a few httpd processes if Apache is up and running.


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow