I put this little guide together as I installed Ubuntu 13.04.
Installing
- Apache
- MySQL
- PHP 5.4
- PHP-FPM
- PHP MySQL Native Driver
Install Apache, PHP, and whichever other modules you may want.
sudo apt-get install apache2-mpm-worker libapache2-mod-fastcgi php5-fpm php5
sudo apt-get install php5-curl php5-gd php5-imagick php-apc php5-cli
Enable Apache modules
sudo a2enmod actions fastcgi alias
sudo service apache2 restart
Install and enabled Apache mod_rewrite
sudo apt-get install mod_rewrite
sudo a2enmod rewrite
sudo service apache2 restart
Add a new virtual host file to /etc/apache2/sites-available
# Virtual Host
<VirtualHost *:80>
ServerName restcms.vm2.home.local
DocumentRoot /home/pjdietz/restcms/htdocs
ErrorLog /home/pjdietz/logs/restcms-error.log
CustomLog /home/pjdietz/logs/restcms-access.log common
<Directory /home/pjdietz/restcms/htdocs>
allow from all
Options -Indexes
AllowOverride All
</Directory>
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
# Automatically gzip these mime types
AddOutputFilterByType DEFLATE text/plain text/html text/xml applicaton/json
</IfModule>
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
</IfModule>
</VirtualHost>
Restart Apache
sudo service apache2 restart
Source: http://www.garron.me/en/blog/ubuntu-lamp-apache2-mpm-worker-and-php-fpm.html
Install MySQL server and the MySQL Native Driver for PHP. (I wrote this part from memory, so I may have missed some packages.) The installation should prompt you for a default root password when it install MySQL.
sudo apt-get install mysql-server php5-mysqlnd
Open port 3306
sudo iptables -A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT
Tell MySQL to use any IP. Edit /etc/mysql/my.conf and ensure it has the following:
bind-address = *
Create users as needed. Open the MySQL command prompt:
mysql -uroot -p{root password you created at installation}
MySQL command line:
CREATE USER 'clientuser'@'192.168.57.%' IDENTIFIED BY 'yourPassword';
GRANT ALL PRIVILEGES ON * . * TO 'clientuser'@'192.168.57.%';
CREATE USER 'localuser'@'localhost' IDENTIFIED BY 'anotherPassword';
GRANT ALL PRIVILEGES ON * . * TO 'localuser'@'localhost';
FLUSH PRIVILEGES;
Restart Apache and MySQL
sudo service mysql restart
sudo service apache2 restart