Install and configure Apache
Installing apache is very easy. After that, understand the options and configure them is more difficult, but not impossible.
To be sure to have the good lists:
#apt-get update
To install apache, just type:
#apt-get install apache2
If you want more informations about the modules and libs you can add to apache, type:
#apt-cache search apache2
And you'll see a list of the packages that are related to apache2. To install one of them, type:
#apt-get install PackageName
It couldn't be more easy ^^ But don't worry, we'll install a lot of other packages after, and explain their utility.
And you're done. Open firefox (or your other lame web browser – just kidding ^^) and open the url of your server (ksXXXXXX.kimsufi.com). You should read “It works!”. And yeah, it works!
I'm used to host many sites on the same server, so I will tell about virtual hosts. And I'm used to put my sites folders in the /home/ folder (comes from the time I was using OVHM (an ovh manager that assists you in your vhosts installation) to create my vhosts, ouch...) But anyway, it's not so terrible, we have a webserver, so it's normal to orient the user side on the sites side.
By default, apache root is /var/www/apache2-default/. I don't like that... Let's create our own root folder.
#mkdir /home/default/
And then tell apache this is the new root. It should be this file:
#vi /etc/apache2/sites-enabled/000-default
There you have the default vhost (we have only one for the moment anyway)
Change DocumentRoot /var/www/ in DocumentRoot /home/default/ and restart apache:
#/etc/init.d/apache2 restart
Clean Apache a little
That's it. In fact, you can clean your 000-default file, only the text below is useful: (I added comments so you can understand what is going on)
NameVirtualHost *
ServerAdmin webmaster@localhost
# The root path of your site
DocumentRoot /home/default/
# Apache will follow the symbolic links, if you don't want apache to, replace by Options -FollowSymLinks
Options FollowSymLinks
# List the content of a folder if no index file is found, if you wanna prevent it, replace by Options -Indexes
Options -Indexes
# If None, .htaccess won't be read. If Yes, .htaccess will be read and the apache configuration can be overrode
AllowOverride None
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature Off
Alias /doc/ "/usr/share/doc/"
Options -Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
I recommend you prevent that apache displays the content of a folder by putting Options -Indexes to your vhosts.
Moreover, I recommend to put ServerSignature off. Less informations a hacker can get, better it is.
To end with this chapter, you can rename 000-default the name you want (000-default is an ugly name)
#mv /etc/apache2/sites-enabled/000-default /etc/apache2/sites-enabled/default
How beautiful :) Our apache server is now installed and clean.
Now let's install the most common modules for apache, in part 4
![[en]](http://blog.shinji.fr/content/img/flags/flag.en.gif)
![[fr]](http://blog.shinji.fr/content/img/flags/flag.fr.gif)