2008年3月18日

[Server] Build a simple Web Server

Install essential package:

1. SSH Server (for remote access)
sudo apt-get install ssh

2. Apache HTTP Server
sudo apt-get install apache2

To view the test page, go to 127.0.1.1 with your browser

Setting:

add .htaccess
vim ~/public_html/.htaccess
add the following code
AuthName "Protect test by .htaccess"
Authtype Basic
AuthUserFile /var/www/apache.passwd
require user test

(default: your account
In newer version, /var/www/apache.passwd has been changed to ~/apache.passwd)

add your account
htpasswd -c /var/www/apache.passwd test
(again, apache.passwd has been changed to ~/apache.passwd)

cp userdir.conf and userdir.load from /etc/apache2/mods-available to /etc/apache2/mods-enabled

Restart apache
sudo /etc/init.d/apache2 restart

沒有留言: