Home >Backend Development >PHP Tutorial >Set up LNMP environment on Raspberry Pi
Build Nginx MariaDB PHP7.0 environment on Raspberry Pi 3rd generation model B.
Nginx
First download the source code of Nginx/PCRE/OpenSSL. I won’t go into the download process. PCRE requires version 1.x, and OpenSSL does not require fips version. After downloading, unzip it. I did it in the /tmp directory.
Install PCRE first, enter the PCRE source code directory, execute ./configure, if there are no errors, then execute make && sudo make install. After completion, enter the Nginx source code directory and execute the command
./configure --prefix=/etc/nginx --with-pcre=/pcre源码目录 --sbin-path=/usr/sbin/nginx --with-http_ssl_module --with-openssl=/openssl源码目录
The meaning of these parameters:
--prefix is the Nginx installation directory, --sbin-path is the location of the Nginx launcher, --with-http_ssl_module Install the SSL module.
Then execute make && sudo make install. After the installation is complete, execute sudo nginx -v to view the Nginx version.
PHP
Install PHP7.0 here.
First modify the source list.
sudo vim /etc/apt/sources.list, add a line:
deb http://mirrordirector.raspbia... stretch main contrib non-free rpi
Then create a file sudo vi /etc/apt/preferences, add the following content:
Package: * Pin: release n=jessie Pin-Priority: 600
Execute sudo apt-get update to update the source. You can start the installation
sudo apt-get install -t stretch php7.0 php7.0-curl php7.0-gd php7.0-fpm php7.0-cli php7.0-opcache php7.0-mbstring php7.0-xml php7.0-zip
After installation, execute php -v to check the version.
MySQL/MariaDB
What I installed here is MariaDB, which is exactly the same as MySQL. It is installed directly with the apt-get command. You can execute the following command to find the version that can be installed
sudo apt-cache search mariadb
After finding the required version, directly use the sudo apt-get install command to install it.
At this point, the configuration of the Web operating environment is completed.
The above is the detailed content of Set up LNMP environment on Raspberry Pi. For more information, please follow other related articles on the PHP Chinese website!