Raspberry IP in Linux, Nginx, SQlite, PHP server (LESP)

Warning : This article has been automatically translated by Google Translate



Un article pour installer rapidement un serveur web avec support PHP et une base de données. Tout ce qu’il faut pour votre site et le rendre disponible sur Internet avec d’excellentes performances.

LESP

On trouve tout un tas de configuration pour un serveur web :

  • LAMP : Linux, Apache, MySQL et PHP
  • LEMP : Linux, Nginx (prononcer Engine X), MySQL et PHP
  • LESP : Linux, Nginx, SQLite et PHP

C’est le troisième qui nous intéresse et qui va permettre d’obtenir les meilleures performances.

  1. Mettre à jour le système
    apt-get update && apt-get -y upgrade
  2. Installer Nginx
    apt-get install nginx
  3. Créer le répertoire /var/www
    mkdir /var/www
    chown -R www-data:www-data /var/www
  4. Installer SQLite
    apt-get install -y sqlite3
  5. Installer PHP et les extensions
    apt-get install -y php5-fpm php5-sqlite php-apc
  6. Configurer le site par défaut de NGinx dans le fichier /etc/nginx/sites-available/default :
    server {
    	listen   80;
    	root /var/www;
    	index index.php index.html index.htm;
    	location / {
    		try_files $uri $uri/ /index.html;
    	}
    	location ~ \.php$ {
    		fastcgi_split_path_info ^(.+\.php)(/.+)$;
    		fastcgi_pass unix:/var/run/php5-fpm.sock;
    		fastcgi_index index.php;
    		include fastcgi_params;
    	}
    }
  7. Redémarrer Nginx
    service nginx restart

Vous voilà prêt avec votre serveur web et votre base de données. Vous pouvez tester ses performances avec Siege et ainsi améliorer la configuration par défaut des différents éléments.

You may also like...

  • Jean-Philippe

    Good evening,
    Thanks for this site which is a gold mine for raspberry !
    It is through grace site that I could finally have a launch at the start of Tighvnc. Thank you !
    Good, I'm at work, No Bowl, everything that is outside the port 80 is filtered, Therefore “bernique” for VNC…I only have teamviewer happening, and no way to put a TViewer on Zhao.

    The Raspi has more memory than me,…. but it is he who motivated to finally stick me to Linux. My old memories of back bring that little.
    I want from “play” also to do a small web server, file etc., perso. I think that there is so much potential to do stuff and not expensive ! I also take my hat off to all these young people who have this imagination, This creativity, I do not know from where they draw their ideas !

    Finally, is it better Ngix LESP, Pancake, another “Kit” ? … I do not know how to do to remove apache 2 of Zhao ?, by dint of installations I am afraid that it will eventually all plant. This is not serious in itself, mais n’ayant pas la mémoire comment est configuré ce qui marche bien 🙂 …..

    I saw on an another tutorial / project the dynamic IP aspect. ( The link cited, inadyn, I did not just understood to tell the truth and e think it wont work with OVH) . However, I tried what is given here : http://pazpop.fr/installer-le-client-dyndns-ipcheck-pour-raspbian-et-ovh/ but it is auto-start of the app at boot which poses problem….as always and should I get aa understand this history from “cron”
    Sorry for this long message
    Once again thank you for this sharing, all these ideas !

    • For your port 80, You can connect on the 80 your House and redirect the 80 input of your box to the port of VNC. Ca ne marchera que si ta boite ne fait que du filtrage de port sans faire de filtrage de contenu 😉

      For apache command apt-get remove apache2 must delete. The advantage of Nginx is that it is simple to learn and especially less greedy resource.

      For automatic start, also look on the side of the boot scripts (There was an article on the blog). Otherwise with @reboot in the crontab

      Good fun with this time-consuming toy ! 🙂

  • Jean-Philippe

    Thanks Chris for all the Info.

    Good home there is no box. At the head of line there is a modem router and the line is shared with several houses, each House having its router. So it's a network of subnets. As it is Orange, No of IP fixed.
    I'll see how I can access from outside directly to my router TPLINK (and see for forwarder ) because at the moment when I put a DDNS I fall on the headend router.

    I'll keep all these tests with the tracks that you have given me.
    OK for Ngix,so, I'll paste in me !
    Et aujourd’hui j’ai commandé d’autres raspi pour les faire causer ensemble 😉

    Come on, I still visit, I treat myself here ! ( even if I do not understand everything the first time )

    • It may be hot for external access because you must ask the head router to redirect incoming traffic (a port number and type of Protocol TCP or UDP) to your subnet that itself should redirect this stream to a specific machine (an IP)… I know how you can do without having the hand on the head of the network. Ask Orange ?

  • Good evening,
    I confirm that this site is a true mine d gold pou novices and linux systems embedded.
    Chris made a super job and deserves to be commended….
    So congratulations
    Ludo

  • Jean-Philippe

    un petit passage pour renvoyer un petit bonjour et un gros merci 😉

  • silco

    Salut 🙂
    Very good site web I like very much; very well explained.
    Just a quick question with SQLite can I have several sites on my server or is it better to leave on the MySQL ?
    Information which will be install on a virtual machine server with Redmine, Jenkins, Sonar …
    Thanks in advance for answers.

    • Hello,
      SQLite stores its DB in the form of a file. MySQL is a database container. Either a SQLite file per site, either a MySQL server with multiple databases. MySQL is more “heavy” but simplifies the administration and said not all the tools to be able to work with SQLite

  • silco

    Thanks for this quick reply.

Handpicked links

disk Page Caching using disk: enhanced Database Caching 77/331 queries in 0.341 seconds using disk Served from: pihomeserver.fr @ 2017-09-17 08:16:41 by W3 Total Cache -->