I am assuming you already have Apache 2.2 installed

Step 1: Install Webmin

You can do everything in this blog post manually, but I found webmin extremely useful. It provides a WebGUI for all kinds of services running on your Linux machine, including apache which is what we are going to use it for.

Step 2: Make sure that auth_digest Apache Module is enables
Go to webmin (https://localhost:10000/ if you installed it with the defaults), open the Servers menu on the left hand side, then click on Apache WebServer and then the Global Configuration tab. In there you will find a Configure Apache Modules icon, click on that. In the list of modules that appears, make sure that auth_digest is enabled (tick the box if not). When done click on "Enable Selected Modules"

Step 3: Add a port
I want to use a special port for my Virtual Host so we need to add this to the WebServer config file so it listens to this new port. You can do this in webmin, just go to Servers -> Apache WebServer and click on the Global configuration tab. There you can click on the Networking and Addresses icon. Add your IP address and the port you want your Apache WebServer to listen to the list and hit Save.

Step 4: Create some users
Your Apache Server comes with an application called htdigest (mine was in /usr/bin/htdigest) that you can use to create users. The syntax is:

sudo htdigest -c

e.g.
> sudo htdigest -c /etc/apache/pwds "By Invitation Only" mark

This will prompt you twice for the password of the user. If you want to add another user, use the same command but without the -c, so

> sudo htdigest -c /etc/apache/pwds "By Invitation Only" foobar

The realm is sort of a grouping mechanism, it will be used later.

This should have created a file pwds in /etc/apache and if you open this file you will see the users, their realms and their (encrypted version of) password.

Step 5: Create a Virtual Server
Go back to webmin, Servers -> Apache WebServer and click on the Create virtual host tab. I specified my ip address and the port I specified earlier (step 3), the document root where all the webfiles are that this Virtual Host is pointing to and I also gave a server name (although I am not sure where this is used), I left the rest as default.

Step 6: Create Directives
In order for the users we created to get access to our Virtual Server, we need to change the directive of the virtual server. You can do this in webmin, go to Servers -> Apache WebServer and click on the Existing virtual hosts tab. From the list, select the virtual server you created. From the page that comes up, select Edit Directives and add the following in the tag:

AuthType Digest
AuthName "By Invitation Only"
AuthDigestDomain
# Optional line:
AuthDigestProvider file
AuthUserFile /etc/apache/pwds
Require valid-user
Options +Indexes

You can see we use the realm here in the AuthName label. is the same as the folder attribute in the tag, and is the full path to your web site, including http://.

And that's it. Go to your website and you will get asked for a user and password or otherwise you cannot get in.

Cheers,
Mark

2 comments

  1. Madhab Jha // May 2, 2013 at 1:41 AM  

    Hello friends,

    Now you can send 5000 FREE emails per month using our email marketing servers with multiple IPs to get your campaign to

    inbox.Get great inbox deliveries and land your 95% emails to inbox.

    With our userfriendly and beautiful web-app you would be able to track every movement of your campaign. You would be able

    to see the users who have opened, clicked, unsubscribed, bounced and marked as spam.

    You can register here for your FREE account:http://www.client.hostwiser.com/cart.php?a=view

    HURRY!!

    * You must have access to your own opt-in list of your subscribers.You must be compliant with the ICANN-SPAM ACT of anti

    spamming.We do not sell email lists.

  2. Madhab Kumar Jha // June 24, 2013 at 4:54 AM  

    EmailOcean is a brand new platform to cater to your email marketing needs.

    It has been launched under the patronage of KOONK TECHNOLOGIES PVT. LTD. and is one of a kind platform for email marketing.

    There is not point in harping on about the advantages of email marketing,as at this point in time,email marketing is the sole way of marketing or promoting your product,service or message in an efficient and quick manner.

    EmailOcean provides you with the following advantages:
    Highly Economical: It provides promotional emailing at an amazingly low rate of $0.10 per 1000 emails. The customer only pay for what is utilised. This is the lowest price available for mass mailing.
    Web App to create and track campaign: The brilliance of EmailOcean lies in it making the process easier and faster for the customer,as compared to Amazon and Sendgrid, EmailOcean has a beautiful Web-app which makes creating and sending the campaign a lot more easier. Using this web-app one can also send and track their campaigns and get detailed analytics.You can see the users who have opened, clicked, unsubscribed and bounced.
    Inbox Deliveries: Their inbox delivery rate is phenomenal.
    Excellent Support: They also provide a support staff that is available at your beck and call 24*7.

    As of now,the registrations are open by invitation but register yourself with the website and keep self updated as to when they are open to all or for your surprise invitation code.