Review your favorite Linux distribution.
Go Back > Blogs > your_shadow03
User Name


Rate this Entry

Setup Apache to publish E-Books for authentic download

Posted 05-05-2009 at 07:28 AM by your_shadow03

You might want to publish e-books through webpage so that everyone can download from your space. In order to setup the required environment, we need to follow up the following steps:

1. Place all the Books under /var/www/html/ebook.
2. Uncomment the following lines under /etc/httpd/conf/httpd.conf so that the output should alike :

ServerAdmin root
DocumentRoot /var/www/html
ServerName localhost
ErrorLog logs/error_log
CustomLog logs/access_log common

3. Also, Modify the following entry under /etc/httpd/conf/httpd.conf

303 # for more information.
304 #
305 Options Indexes FollowSymLinks
307 #
308 # AllowOverride controls what directives may be placed in .htaccess file s.
309 # It can be "All", "None", or any combination of the keywords:
310 # Options FileInfo AuthConfig Limit
311 #
312 # AllowOverride None
313 AllowOverride AuthConfig
314 #
315 # Controls who can get stuff from this server.
316 #
317 # Order allow,deny
318 # Allow from all
319 Order deny,allow
320 Deny from all
321 Allow from all

Your file should be modified as per line number shown above(for convenience)

4. Create .htaccess file under /var/www/html/ebook

AuthType Basic
AuthName "restrcited webpage"
AuthUserFile /etc/httpd/conf/.htpasswd
require valid-user

7.Create .htpasswd file through the command:

cd /etc/httpd/conf
htpasswd -cm .htpasswd roger
htpasswd -m .htpasswd alice

Please note the options -cm and -c ..they are different.

8. Restart the httpd service.
9. try logging into http:///ebook

The Screen will ask you for username and passwd. Supply the same which we created through step 7.
And on Successfull credential it will allow to enter the library for ebooks

The Setup is not complete yet.
We can also limit user to view a particular book through this entry additional to /var/www/html/ebook/.htaccess

AuthType Basic
AuthUserFile /etc/httpd/conf/.htpasswd
AuthName "restrcited webpage"
require valid-user

Anonymous roger alice
Anonymous_Authoritative on
Anonymous_VerifyEmail on

#Please add < before Files *.chm and > after chm
Files *.chm
Require user roger

Files *.txt
Require valid-user

On restarting the httpd server we will find that roger can view all .chm extension files while alice can only view .txt file thereby not allowing alice to view all that roger can view.

Hope it adds more to your experimentation on Apache.
Happy LinuXing
Posted in Uncategorized
Views 1401 Comments 0
« Prev     Main     Next »


All times are GMT -5. The time now is 04:57 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration