Apache is a widely used HTTP server.
Install:
emerge apache
The daemon is /usr/sbin/httpd.
The deamon control script is /usr/sbin/apache2ctl.
You can make a first test as follows:
su and give root password.
/usr/sbin/apache2ctl start.
Add Apache 2 to startup:
rc-update add apache2 default
Configuration data is found in /etc/apache2/conf/,
especially in apache2.conf or commonapache2.conf.
Check this with apache2ctl -V.
Edit the configuration file /etc/apache2/conf/apache2.conf
and uncomment the line
#ServerName localhost
This will keep away the annoying startup/shutdown message:
[...] Could not determine the server's fully qualified domain name [...].
The httpd.conf configuration file specifies the HTTP root directory with the directive DocumentRoot.
Default value is /var/www/localhost/htdocs.
Place your index.html file in that directory.
If you intend to run Unix commands from within index.html, be sure to chmod 755 index.html.
You can link from your startup index.html to another file in another directory branch.
However, you then need to tell Apache he has to grant access to this new directory.
Edit /etc/apache2/conf/apache2.conf or .../commonapache2.conf
(su as root).
Find the line <IfModule mod_alias.c>.
After this line, add the lines
Alias /directoryName/ "yourDirectoryLocation/"
<Directory "yourDirectoryLocation">
Options Indexes FollowSymlinks MultiViews +ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Restart the HTTP deamon: /usr/sbin/apache2ctl restart.
/usr/sbin/apache2ctl restart
With this, you can link into yourDirectoryLocation from the startup index.html.
As an example, you can write:
<A href="directoryName/index.html"[ Surf on to a special page ]</A>
Make sure you also grant read access of your directories and files on the Unix file system to the web browser user...
You can password-protect a directory.
Edit /etc/apache2/conf/apache2.conf or .../commonapache2.conf
(su as root).
Add the definition:
<Directory "yourDirectoryLocation">
Options Indexes FollowSymlinks MultiViews +ExecCGI
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /var/www/localhost/passwd/passwords
AllowOverride None
Order allow,deny
Allow from all
Require user pascal
</Directory>
Build the password file.
mkdir /var/www/localhost/passwd
htpasswd2 -c /var/www/localhost/passwd/passwords username
Restart the HTTP deamon: /usr/sbin/apache2ctl restart.
/usr/sbin/apache2ctl restart
Try to access the password-protected pages with a web browser.