树莓派lnmp安装mysql_在树莓派上安装 LNMP
樹(shù)莓派支持安裝非常多的操作系統(tǒng),如官方所展示:
這里我選擇了推薦的 Raspbian 系統(tǒng),它基于 Debian,這就意味著我可以按照 Debian 的方式來(lái)安裝軟件。
一、安裝 Nginx
0、先將系統(tǒng)更新到最新?tīng)顟B(tài)
$ sudo apt-get update && sudo apt-get upgrade
1、下載 nginx
$ sudo apt-get install nginx -y
2、啟動(dòng) Nginx 服務(wù)
$ sudo /etc/init.d/nginx start
3、打開(kāi)樹(shù)莓派的 IP 地址
[ ok ] Starting nginx (via systemctl): nginx.service.
二、安裝 PHP
配合Nginx使用時(shí),PHP的安裝包和Apache2配合使用稍微有些不同,PHP以FastCGI接口方式運(yùn)行,因此我們需要安裝PHP FPM包。
1、下載 PHP:
$ sudo apt-get install php5-fpm -y
2、在 Nginx 啟動(dòng) PHP:
$ cd /etc/nginx
$ sudo vim sites-enabled/default
找到
index index.html index.htm;
添加 index.php
index index.php index.html index.htm;
往下滾找到
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
# location ~ \.php$ {
去除 # 注釋改成:
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
它應(yīng)該看起來(lái)像:
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
重新加載配置文件:
$ sudo /etc/init.d/nginx reload
3、啟動(dòng) PHP:
$ sudo service php5-fpm start
三、測(cè)試 PHP
1、重命名文件
$ cd /var/www/html/
$ sudo mv index.nginx-debian.html index.php
2、編輯文件
$ sudo vim index.php
3、在合適的地方填入:
4、觀看效果:
四、安裝 MySQL待續(xù)
翻譯自:
總結(jié)
以上是生活随笔為你收集整理的树莓派lnmp安装mysql_在树莓派上安装 LNMP的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 双曲函数奇偶性_基本初等函数之奇偶性(强
- 下一篇: 风变python怎么样_Python取代