在树莓派上搭建LNMP环境-php教程

资源魔 32 0
正在树莓派3代B型上搭建Nginx+MariaDB+PHP7.0环境。

Nginx

起首下载Nginx/PCRE/OpenSSL的源码,下载进程就没有说了,PCRE要1.x版本,OpenSSL没有要fips版本。下载好之后解压,我是正在/tmp目次操作的。

先装置PCRE,进入PCRE源码目次,执行 ./configure,不谬误的话,接着执行 make && sudo make install。实现落后入Nginx源码目次,执行饬令

./configure --prefix=/etc/nginx --with-pcre=/pcre源码目次 --sbin-path=/usr/sbin/nginx --with-http_ssl_module --with-openssl=/openssl源码目次

这几个参数的意义:

--prefix 是Nginx的装置目次,--sbin-path 是Nginx启动器的地位,--with-http_ssl_module 装置SSL模块。

接着执行 make && sudo make install,装置实现后执行 sudo nginx -v 能够查看Nginx的版本。

PHP

这里装置PHP7.0。

起首修正源列表。

sudo vim /etc/apt/sources.list ,增加一行:

deb http://mirrordirector.raspbia... stretch main contrib non-free rpi

接着创立一个文件 sudo vi /etc/apt/preferences,增加如下内容:

Package: *
Pin: release n=jessie
Pin-Priority: 600

执行 sudo apt-get update 更新源。能够开端装置了

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

装置好之后执行 php -v 能够查看版本。

MySQL/MariaDB

这里我装置的是MariaDB,跟MySQL应用形式如出一辙,间接用 apt-get 饬令装置。能够执行如下饬令,查找能够装置的版本

sudo apt-cache search mariadb

找到需求的版本后间接用 sudo apt-get install 饬令便可装置。

至此Web运转环境就设置装备摆设实现了。

以上就是正在树莓派上搭建LNMP环境的具体内容,更多请存眷资源魔其它相干文章!

标签: php开发教程 php开发资料 php开发自学 LNMP

抱歉,评论功能暂时关闭!