Sometimes I find myself helping friends, family, and coworkers set up servers to run their web projects. I have a strong preference towards Ubuntu and its sane configuration. I have created a script for installing a LAMP (Linux, Apache, MySQL, and PHP) server on Ubuntu 16.04, I have not tested the script on other versions Ubuntu.
#Run the following as root wget http://benarchuleta.com/scripts/web.sh chmod +x web.sh ./web.sh
Afterward you can edit PHP and Apache configuration files to fine tune your server. On apache I like to run:
a2enmod rewrite expires deflate a2dismod status service apache2 restart
I also like to set the following variables in the php.ini file:
memory_limit = 128M upload_max_filesize = 32M post_max_size = 96M date.timezone = America/Denver
I leave everything else default.