Web server setup
Today we will discuss about basic Apache-based web server installation. This is a quite straightforward process on Debian systems.
I will also present the steps to setup the most commonly used Apache modules.
As root, issue the command:
apt-get install apache2
This will download and install the required packages for installing and starting the Apache server. That's all ! If the server is installed on your host system, simply check everything is okay by directing your favourite web browser to the URL : http://localhost/.
You should be able to read the simple message :
It works !
If your web server has been installed on a guest virtual system, and you configured a virtual network like in this previous article, you should be able to access it through this URL: http://192.168.10.2/.
User home pages
You can enable your Unix users to have their own web pages. The root directory for each user, if present, will be $HOME/public_html. The URL for each of the users home pages will be http://your-web-server-url.com/~username/.
User home pages are deactivated by default. To enable them, issue the commands:
PHP is the most used scripting language for web applications (just like this blog infrastructure for instance). Install it and activate it using the single command:
apt-get install libapache2-mod-php5
Virtual host setup
The web server running this blog handles different websites from the same IP address. The website to be served depends on the virtual host name from which the web server is accessed. You will have to set up each of the servers separately in different configuration files, put into the /etc/apache2/sites-available directory. For this blog, for instance, I created a /etc/apache2/sites-available/blog file, containing the following:
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
CustomLog /var/log/apache2/access.log combined
It simply maps all accesses from the http://blog.ouasse.ath.cx/ URL to the local /home/ouasse/www/dotclear directory, which has been configured with www-data group rights.
After having created such a website configuration file, activate it using the commands:
Where filename is the name of the configuration file. For the example above, I would have used the
That's all ! As you have seen, Apache2 base installation is quite straightforward. In future articles I may talk about configuring Apache for doing funny stuff like virtual hostname-based websites, and installing full applications such as the Doctclear blog infrastructure which I use for running this blog.