Minimal How to Setup LAMP Web Server

Apache

Apache 2.0

Install Apache from Debian stable:

apt-get install apache2

Apache is ready and running. Test that it is workin by pointing browser to www.mysite.com. Read Apache’s security tips.

Apache’s files and directories are:

  • /etc/apache2/sites-available/mysite.com: Your virtual domain configuration.
  • /etc/apache2/sites-enabled/mydomain.com: Symlink to you configuration, when site is enabled with a2ensite mysite.com command.
  • /var/log/apache2/: Logs.
  • /var/www/mysite.com: Your site.

Install Cronolog:

apt-get install cronolog

Make your sites configuration file in /etc/apache2/sites-available/mysite.com:


  ServerAdmin [email protected]
  ServerName www.mysite.com
  ServerAlias mysite.com
  DocumentRoot /var/www/mysite.com
  ErrorLog "|/usr/bin/cronolog /var/log/apache2/%Y/%Y-%m-mysite.com-error.log"
  CustomLog "|/usr/bin/cronolog /var/log/apache2/%Y/%Y-%m-mysite-com-access.log" combined

Make /var/www/mysite.com directory for your sites files. Enable your sites configuration file:

a2ensite mysite.com

Reload Apache:

/etc/init.d/apache2 reload

If you for some reason want to remove the site from Apache configuration:

a2dissite mysite.com

More about installing Apache.

PHP

PHP 5.1

In order to use apt-get to install PHP 5, you need to add one of the dotdeb.org mirrors to /etc/apt/sources.list, like:

deb http://packages.dotdeb.org stable all

And istall PHP:

apt-get update
apt-get install libapache2-mod-php5

Php.ini is in /etc/php5/apache2/php.ini and recommended .ini is in /usr/share/doc/php5-common/examples/php.ini-recommended.

More about installing PHP.

MySQL

MySQL 5.0

Install MySQL also from dotdeb.org as PHP:

apt-get install mysql-server
apt-get install php5-mysql

More about installing MySQL.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top