How to install Apache on Linux

An easy step-by-step guide to setting up an Apache Web server on Fedora, CentOS, or Ubuntu

By Paul Venezia, InfoWorld |  Software, Apache, centos

Once you're comfortable with the basics, you can move on to other advanced configuration elements. For instance, it's relatively simple to password-protect a site or directory using .htaccess files. To do this, you need to create a file named .htaccess in the document root of the virtual host (or Apache server) and add these lines:

AuthUserFile /etc/httpd/webpasswds AuthName "My Web Auth" AuthType basic <Limit GET POST>
</Limit>

Then create the password file. On Fedora or CentOS:

htpasswd -c /etc/httpd/webpasswds myuser

On Ubuntu:

sudo htpasswd -c /etc/apache2/webpasswds myuser

Make sure you have set AllowOverride All, or at least AllowOverride Limit, in your configuration file as noted above. After you've done this and reloaded the server, users will be presented with a login dialog box before they can access the website. You can add more usernames and passwords using the same htpasswd command, though you don't need to use the -c flag if you're just adding more users.

To infinity and beyond With any luck, you've just succeeded in getting Apache up and running on a modern Linux server. There's much more to know about the Apache Web server, and the best way to learn is to experiment with different configurations. You'll want to bookmark Apache's documentation for the version you're running.

It's unwise to put sensitive information on any Web server until you're comfortable that the configuration is proper. It's too easy to make configuration errors that expose information inadvertently. If you're just starting out with Apache and Linux, take the time to research and educate yourself first, and perhaps find someone more knowledgeable to verify your configurations before placing your server into production.

This article, "How to install Apache on Linux," was originally published at InfoWorld.com. Follow the latest developments in applications and Web application development at InfoWorld.com. Get a digest of the key stories each day in the InfoWorld Daily newsletter. For the latest business technology news, follow InfoWorld on Twitter.

Read more about applications in InfoWorld's Applications Channel.


Originally published on InfoWorld |  Click here to read the original story.
Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question