Diegiame web serverį naudojant lighttpd+php+mysql
Diegiame nesudėtingą web serverį lighttpd + php + mysql.
Instaliuojame lighttpd
Vykdome šią komandą:
sudo apt-get install lighttpd
įdiegiama priklausantys paketai ir aktyvuojama, konsolėje matome:
[ ok ] Starting web server: lighttpd.
Diegiame mysql duomenų dazę
Dauguma turinio valdymo sistemų reikalauja turėti duomenų bazę, tam įdiegsime mysql:
sudo apt-get install mysql-server
diegimo metu jūsų paklaus sukurti mysql root vartotojo slaptažodį.
Diegiame PHP
vydant šią komandą įdiegsime PHP v. 5.
sudo apt-get install php5-common php5-cgi php5 php5-mysql
Note it’s important to install in the order listed above. If you try to install php5 without first installing the php5-cgi package then it will install Apache as well, which we don’t want for this light-weight lighttpd server.
Įjungiame fastcgi-php modulį naudojant šia komandą:
sudo lighty-enable-mod fastcgi-php
perkrauname naudodami:
sudo service lighttpd force-reload
Sutvarkome teises aplankui /var/www/
Pakeičame aplankų teises kad vartotojai galėtų koreguoti šio aplanko turinį neturint root teisių. Keičiame aplanko savininką ir grupę
sudo chown www-data:www-data /var/www
leidžiame grupei rašyti šiame aplanke
sudo chmod 775 /var/www
pridedame pi vartotoją į www-data grupę
sudo usermod -a -G www-data pi
Testuojame serverį
Įvedame įrenginio IP adresą ir peržiūrime ar veikia web serveris.
Ištriname /var/www/index.lighttpd.html ir sukuriame failą /var/www/index.php su turiniu:
<?php phpinfo(); ?>
Vėl įvedame įrenginio IP adresą ir peržiūrime ar veikia PHP.