在樹莓派3代B型上搭建Nginx+MariaDB+PHP7.0環境。php
Nginxnginx
首先下載Nginx/PCRE/OpenSSL的源碼,下載過程就不說了,PCRE要1.x版本,OpenSSL不要fips版本。下載好以後解壓,我是在/tmp目錄操做的。vim
先安裝PCRE,進入PCRE源碼目錄,執行 ./configure,沒有錯誤的話,接着執行 make && sudo make install。完成後進入Nginx源碼目錄,執行命令segmentfault
./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模塊。php7
接着執行 make && sudo make install,安裝完成後執行 sudo nginx -v 能夠查看Nginx的版本。curl
PHPurl
這裏安裝PHP7.0。首先修改源列表。sudo vim /etc/apt/sources.list ,添加一行:xml
deb http://mirrordirector.raspbia... stretch main contrib non-free rpi
接着建立一個文件 sudo vi /etc/apt/preferences,添加如下內容:ip
Package: *
Pin: release n=jessie
Pin-Priority: 600
執行 sudo apt-get update 更新源。能夠開始安裝了ssl
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運行環境就配置完成了。
相關文章: