So these are the general steps for setting up a web server (Apache, MySQL and PHP) on a Ubuntu 10.4 server. If you are not sure on how to use unix command line see: https://leonardaustin.com/blog/technical/ssh-commands

Upgrade Ubuntu

apt-get update
apt-get upgrade --show-upgraded

Install Apache MySQL and PHP

apt-get install apache2 mysql-server php5 php-pear php5-mysql

Then Secure MySQL

mysql_secure_installation

Setup vhosts

Create a file in the /etc/apache2/sites-available/ directory for each virtual host that you want to set up. Name each file with the domain for which you want to provide virtual hosting. See the following example configurations for the hypothetical “example.com” domain.

<VirtualHost *:80>
     ServerAdmin [email protected]
     ServerName example.com
     ServerAlias www.example.com
     DocumentRoot /srv/www/example.com/public_html/
     ErrorLog /srv/www/example.com/logs/error.log
     CustomLog /srv/www/example.com/logs/access.log combined
</VirtualHost>

Then create the folders

mkdir -p /srv/www/example.com/public_html
mkdir /srv/www/example.com/logs

Enable the site and reload Apache

a2ensite example.com
/etc/init.d/apache2 reload

Install mod_rewrite

sudo a2enmod rewrite
sudo /etc/init.d/apache2 reload

You also need to find this file:

/etc/apache2/sites-available/default

and change “AllowOverride None” to “AllowOverride All” it appears a couple of times.

Install PHPMyAdmin

sudo apt-get install phpmyadmin

“In /etc/apache2/apache2.conf” Add “Include /etc/phpmyadmin/apache.conf” The restart apache

/etc/init.d/apache2 reload

Install XBedug - Optional for DEV only

sudo apt-get install php5-dev php-pear
sudo pecl install xdebug

Make a note of the location of the xedebug.so then create a xdebug.ini with the below info and put it into “/etc/php5/conf.d”


; xdebug debugger
zend_extension="/usr/lib/php5/20060613/xdebug.so"
# IN php.ini file make sure html_errors = true
/etc/init.d/apache2 restart

PHP Important Folder and Files

# /etc/php5
# /etc/php5/apache2/php.ini

Apache Important Folder and Files

# /etc/apache2/
# /etc/apache2/apache2.conf
# /etc/apache2/sites-available/default

Web Folders

# /srv/www/

or the default location

# /var/www

Other Steps

Change php.ini errors to show all