Skip to content

Instantly share code, notes, and snippets.

@marciopaiva
Last active January 1, 2016 08:19
Show Gist options
  • Save marciopaiva/8117193 to your computer and use it in GitHub Desktop.
Save marciopaiva/8117193 to your computer and use it in GitHub Desktop.
DigitalOcean - Instalação do Apache 2.4.x + PHP 5.5.x no Ubuntu 13.10

DigitalOcean - Instalação do Apache 2.4.x + PHP 5.5.x no Ubuntu 13.10


Update e LocalTime São Paulo

sudo apt-get update
sudo dpkg-reconfigure tzdata

Configuração do repositório para Apache 2.4 e PHP 5.5

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update

Instalação do Apache 2.4.x

sudo apt-get install apache2
sudo a2enmod rewrite

Instalação do PHP 5.4.x

sudo apt-get install php5 php5-apcu php5-gd php5-intl php5-mysql

Instalação do Google's PageSpeed Module

wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb
sudo dpkg -i mod-pagespeed-*.deb
sudo apt-get -f install
sudo chown www-data:www-data /var/cache/mod_pagespeed/ -R

Tuning Apache para 512 ram

sudo nano /etc/apache2/apache2.conf
Timeout 20
KeepAlive On
MaxKeepAliveRequests 50
KeepAliveTimeout 10
sudo nano /etc/apache2/mods-enabled/mpm_prefork.conf
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers       15
    MaxClients            20
    MaxRequestsPerChild   500
</IfModule>

Listar Modulos instalados (remover mods não necessários)

sudo apachectl -t -D DUMP_MODULES

Tuning PHP

sudo nano /etc/php5/apache2/php.ini
memory_limit = 100M
upload_max_filesize = 8M
date.timezone = America/Sao_Paulo
sudo nano /etc/php5/apache2/conf.d/05-opcache.ini
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1

Reiniciar Apache

sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment