Apache2 (servidor web)
Nesta página pode consultar algumas configurações possíveis para o serviço apache com autenticação.(a distribuição escolhida foi o Ubuntu Server 9.04)

Convenção:  a itálico->comandos a executar no terminal
                   a negrito->divisão dos passos a efectuar
                   a azul->conteúdo do ficheiro de configuração
                   entre <> -> instrução genérica a substituir por dados do utilizador/sistema

:~$ sudo apt-get install apache2

:~$ sudo mkdir /var/www/rumos
:~$ sudo cp /var/www/index.html /var/www/rumos/
:~$ sudo nano /var/www/rumos/.htaccess

:~$ htpasswd -c /var/www/rumos/.htpasswd rumos
htpasswd: cannot create file /var/www/rumos/.htpasswd
:~$ sudo htpasswd -c /var/www/rumos/.htpasswd rumos
New password:
Re-type new password:
Adding password for user rumos
...................................................................
    uthName "nome"
    AuthType Basic
    require valid-user <nomedoutilizador>
...................................................................

:~$ sudo nano /var/www/rumos/.htaccess
..................................................................
    uthName "nome"
    AuthType Basic
    require valid-user <nomedoutilizador>
    AuthUserFile /var/www/rumos/.htpasswd
...................................................................

:~$ sudo /etc/init.d/apache2 restart
     * Restarting web server apache2                                         apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting .apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
                                                                         [ OK ]

:~$ sudo nano /var/www/rumos/index.html

....................................................................
    <html><body><h1>Пробний документ It works!</h1>
    <p>This is the default web page for this server.</p>
    <p>The web server software is running but no content has been added, yet.</p>
    </body></html>
....................................................................

:~$ sudo nano /etc/apache2/httpd.conf
....................................................................
    <Directory /var/www/rumos>
    AllowOverride All
    </Directory>
....................................................................

:~$ sudo /etc/init.d/apache2 restart
     * Restarting web server apache2                                                apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
                                                                         [ OK ]
-------------------------------------------------------------------------------
http://localhost/rumos/
а��ОаБаНаИаЙ аДаОаКб�МаЕаНб�It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

Comments