# Tuning LAMP for different resources

## AlexanderKh

I am learning tuning of LAMP (Apache - MySQL - PHP) for different types of websites (please do not recommend another components, they are not applicable for me).

I am interested in 3 types of websites:

1. blog

2. forum

3. online store

Imagine that each of these websites has dedicated server with the same configuration, what would be general tips on tuning LAMP for each of them?

For example, forum requires more tuning of MySQL, while store needs PHP optimized, etc.). Any suggestions?

----------

## Jzomer

To have a webserver secure you would have to have everything secure.

It's not only your LAMP stack that has to be secure but also your box.

A few tips are:

- Keep your kernel up to date

- Use hardened gentoo/SELinux/grsec for optimalizing security.

- Configure iptables or any other firewall according to your preference (a nice tool for creating an iptables config is http://www.mista.nu/iptables/)

Configuring sysctl is also a good security practice, here I have an example sysctl.conf:

 *Quote:*   

> # Avoid a smurf attack
> 
> net.ipv4.icmp_echo_ignore_broadcasts = 1
> 
> # Turn on protection for bad icmp error messages
> ...

 

When writing those websites you should be carefull with sanitizing input, make sure to use input validation at all times.

A great post on securing mysql databases is: 

https://www.digitalocean.com/community/tutorials/how-to-secure-mysql-and-mariadb-databases-in-a-linux-vps

Also you should definetly read this:

https://www.owasp.org/index.php/PHP_Security_Cheat_Sheet

Do not hesitate to contact me for any further questions.

Kind Regards,

Jordy

----------

