Friday, April 1, 2011

Apache

Now we are starting to get somewhere. Let's install the webserver now so we can host some GIS web-sites  very soon.

Install Apache web server from a terminal...
$ sudo apt-get install apache2
Here is a list of the important paths and files that you may need to edit at some point...
/etc/apache2/ (server root)
/etc/apache2/mods-available (apache modules you can load)
/etc/apache2/mods-enabled (apache modules loaded)
/etc/apache2/sites-available (virtual host files you can load)
/etc/apache2/sites-enabled (virtual host files loaded)
/etc/apache2/apache2.conf (main configuration file)
/etc/apache2/error.log (error log file)
/etc/apache2/port.config (ports file)


You may want to add the server name to the main configuration file at /etc/apache2/apache2.conf
ServerName <Name>

In the /etc/apache2/sites-available folder you will find a default virtual host file. You can enable this website by running the command below. This command simply creates a link file in the /etc/apache2/sites-enabled folder. Restarting Apache will then load this website, making it reachable.
$ sudo a2ensite default
You can disable this virtual host website using this command...
$ sudo a2dissite default
These virtual host files simply contain all the website configuration information needed to make the website live. You can see in the screenshot below that the default virtual host file is pointing to a document root of /var/www. By default there is an index.html file in that path, so once you apply permissions to this folder and restart apache, it should work.


So, let's assign permissions to the document root folder now. This is not the most secure way to do things, but it is good enough for now. This gives all read and execute permissions recursively on all files and folders withing /var/www.
$ sudo chmod -R a=rx /var/www/
Now restart the apache web server so all these changes are loaded...
$ sudo /etc/init.d/apache2 restart
Now go the the URL that points to your web server and you should see...


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.