Servidor web ràpid: NginX + HHVM
sudo apt-get update
sudo apt-get install -y unzip vim git-core curl wget build-essential zlib1g-dev libpcre3 libpcre3-dev libbz2-dev libssl-dev libssl-doc zlib1g-dev libmemcachedutil2
Anem a instal·lar NGINX amb el mòdul Pagespeed:
sudo apt-get install -y nginx
wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -
echo deb http://dl.hhvm.com/debian wheezy main | sudo tee /etc/apt/sources.list.d/hhvm.list
sudo apt-get update
sudo apt-get install hhvm
Si va bé, sortirà:
********************************************************************
* HHVM is installed.
*
* Running PHP web scripts with HHVM is done by having your webserver talk to HHVM
* over FastCGI. Install nginx or Apache, and then:
* $ sudo /usr/share/hhvm/install_fastcgi.sh
* $ sudo /etc/init.d/hhvm restart
* (if using nginx) $ sudo /etc/init.d/nginx restart
* (if using apache) $ sudo /etc/init.d/apache restart
*
* Detailed FastCGI directions are online at:
* https://github.com/facebook/hhvm/wiki/FastCGI
*
* If you're using HHVM to run web scripts, you probably want it to start at boot:
* $ sudo update-rc.d hhvm defaults
*
* Running command-line scripts with HHVM requires no special setup:
* $ hhvm whatever.php
*
* You can use HHVM for /usr/bin/php even if you have php-cli installed:
* $ sudo /usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60
********************************************************************
Per tant, ara fem:
apt-get install libboost1.49-dev libboost-regex1.49-dev libboost-system1.49-dev libboost-program-options1.49-dev libboost-filesystem1.49-dev libboost-thread1.49-dev
sudo /usr/share/hhvm/install_fastcgi.sh
sudo /etc/init.d/hhvm restart sudo /etc/init.d/nginx restart
sudo update-rc.d hhvm defaults
I ara podrem també executar scripts de php en la línia de comandes:
cat > /usr/share/nginx/www/index.php
<?php echo "<h1>".php_info()."</h1> \n <br /> \n <hr> \n"; ?> (I apretem ctrl +C)
hhvm /usr/share/nginx/www/index.php
Comprovem que HHVM és qui executa el codi php per defecte:
root@debian:~# php -v
HipHop VM 3.3.0 (rel)
Compiler: tags/HHVM-3.3.0-0-g0a3cfb87b8a353fc7e1d15374f4adc413e37aba9
Repo schema: 9a391d9a03e15fccba1cde6d35c05b7cdd380238
Extension API: 20140829
Anem a continuació al navegador a l’adreça {IPdelamàquina}/index.php
, i si veiem bé la pàgina vol dir que ho tenim tot correctament configurat.
Només queda personalitzar el que es vulgui i disfrutar.
TODO: nginx+pagespeed des d’un repositori: https://kura.io/2013/07/10/nginx-spdy-and-ngx-pagespeed/ https://kura.io/2014/07/09/nginx-1.7.3-released-with-pagespeed-psol-1.8.31.4-and-naxsi-0.53-2/
Enllaços:
https://github.com/facebook/hhvm/wiki/Prebuilt-Packages-on-Debian-7
Altres