David-Halliday.co.uk

LAMP and LAP

LAMP is the acronym given to Linux Apache Mysql and PHP. I'm personally only interested in LAP (sorry for the poor joke) as I'm not interested in using databases at this moment.
The Linux part is easy enough to do as (In this instance) Debian is installed. If you want more detail about things, especially MySQL and security they you are best off looking at the LAMP how to site.

This page has been updated after I installed & configured a web server for testing purposes at the very start of June 2007.

Apache

XXXXXXXX

The Apache web server is the most common web server available for any OS and is prevalent for a good reason, It's the best. The easiest way to install Apache with PHP is to select "web server" from the list of options when you install Debian. This will also put PHP 4 on the system.
If you didn't select web server at install time then you need to install apache now:

apt-get install apache2 

This will install Apache but not PHP or MySQL. 

PHP

To install the PHP Hypertext Preprocessor you have to get the PHP4 apache mod package:

apt-get install libapache2-mod-php4

Securety warning

Taken from the php.ini file:

By default, PHP installs itself with a configuration suitable for development purposes, and *NOT* for production purposes. For several security-oriented considerations that should be taken before going online with your site, please consult php.ini-recommended and http://php.net/manual/en/security.php. There are also warnings and tips available from I love Jack Daniels (don't let the name put you off).

MySQL

The server is easy to install from the debian repository. Sorry this bit is poorly documented.
apt-get install mysql-server
You may also want to install PHPmyadmin to easily administer & configure your database. For this just get it from the repository:
apt-get install phpmyadmin
If you are using PHP (if phpmyadmin is installed then you are) then you will need the php MySQL package:
apt-get install php4-mysql

Then you are ready to navigate to the directory "phpmyadmin" from the server root e.g. "www.myserver.com/phpmyadmin". The web interface makes this easy to install and configure remotely using a web browser and the ssh server.

You may need to set a root password for mysql. so after the install do this:

mysqladmin -u root password yourrootsqlpassword

Configuration

As I'm working on an internal server that is not mission critical I'm not particularly interested in security. For my needs the standard security is sufficient. This is not sufficient for a server accessible to the outside world from the internet.

A first for me was to prevent all users going to the root of the server "http://rockhopper" being redirected to "/apache2-default". this is in the file: "/etc/apache2/sites-available/default" you have to comment out the line "RedirectMatch ^/$ /apache2-default/". Then put a default page in "/var/www/" which will now replace the default apache2 holding page.

Depending on what you want to do different settings in the configuration file for apache2 will need to be altered the file can be found in its default location:

/etc/apache2/apache2.conf

The first change I wanted to make was to allow users to have their own web space from the server allowing them to access the page from:

http://rockhopper/~username

This is actually fairly easy to do, (all be it harder than before due to changed made by the apache people) all you have to do is link to three modules from the /mods-available/ directorie in the /mods-enabled/ directorie. This is simply done by the two lines below (if you are using the default debian settings):

ln -s /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled/include.load
ln -s /etc/apache2/mods-available/userdir.load /etc/apache2/mods-enabled/userdir.load 
ln -s /etc/apache2/mods-available/userdir.conf /etc/apache2/mods-enabled/userdir.conf

Users can now save html files in a subdirectorie of their /home/ directorie called

public_html

enable CGI

Sometimes you may wish to work with cgi files on example of using these is if you want to use the quiz test scripts, If this is the case then you have to enable cgi for users. Information on this is available under the apache FAQs (which are very useful) here is the article on enabling cgi-bin for users. In short all you have to do is add the following to your apache apache2.conf file:

Options ExecCGI
SetHandler cgi-script

I have placed this above the similar settings for /public_html/cgi-bin (which should remain commented out).

Upload files

The most common method for uploading files to a web server is by using FTP. See my guide on setting up vsftpd under Debian.

powered by cmsimple.dk - powered by cmsimple-styles.com