Pick a Free OS

User login

Navigation

Web server tutorial - Part 3


Now people might ask why are we going /home/httpd/html for html files and why do we go for /home/httpd/cgi-bin. Well, it is just because of the macro.


Documentroot /home/httpd/html and

Script-alias /home/httpd/cgi-bin/ /cgi-bin/

<Directory "/home/httpd/html">

Options Indexes Includes FollowSymLinks

AllowOverride all

Order allow,deny

Allow from all

</Directory>


In above directive, `options' is the facility on that directory.

Indexes

The default file to be accessed is index.html.

`AllowOverrride' all or none: Sometimes user wants to put password protection to its directory of information. This can only be done if AllowOverrride all is written under the

<Directory> </Directory>


Can you password protect any directory? Yes you can (discussed later in password protection topic).

Macro in /etc/httpd/conf/httpd.conf

You may ask why is action=/cgi-bin/a.pl. It is just because the script alis macro tells that there is no need to give such a long path its better to give the short alias naming of directory. So, in normal hosting of html, files should be in /home/httpd/html/. And normal cgi file should stay at /home/httpd/cgi-bin with 755 permissions.

Hosting in Virtual Directory

Why is it needed?


We have just seen that http://127.0.0.1/ is mapped with /home/httpd/html/index.html. And if the file is not index.html, let's say a.html, then we have to call http://127.0.0.1/a.html. Now suppose a client also wants not to write the file name after the URL then in that case the Web server says, "create a login for each user who wants to host his site and then make a directory called "public_html" under login directory and now put index.html under that directory". For that, the directive in /etc/httpd/conf/httpd.conf should look like UserDir public_html


<Directory /home/*/public_html>

AllowOverride FileInfo AuthConfig Limit

Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

<Limit GET POST OPTIONS PROPFIND>

Order allow,deny

Allow from all

</Limit>

<Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>

Order deny,allow