目的:搭建 nginx + php7.3 + sqlite3 WEB 服务器
硬件: RPI 3B+, NORDIC nRF52840 USB Dongle
系统: Linux raspberrypi 4.19.118-v7+
安装操作
sudo apt-get update
sudo apt-get install nginx
sudo apt-get install php7.3-fpm php7.3-cli php7.3-curl php7.3-gd php7.3-cgi
sudo apt-get install sqlite3 php7.3-sqlite3
sudo service nginx start
sudo service php7.3-fpm restart
查看 nginx 服务状态
systemctl status nginx.service
nginx 配置支持处理 php 文件
sudo vi /etc/nginx/sites-available/default
将其中内容
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
更改为
location / {
index index.html index.htm index.php default.html default.htm default.php;
}
location ~\.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
重启 nginx 使配置生效
sudo service nginx restart
nginx 网站根目录 (website root): /var/www/html/
测试文件 info.php
<?php
phpinfo();
?>
ngrok 内网穿透 WEB 服务
下载程序及解压
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.zip #32 bits
unzip ngrok-stable-linux-arm.zip
运行 ngrok
./ngrok http 80
通过 ngrok 访问内网
http://e0d36bdccbce.ngrok.io
https://e0d36bdccbce.ngrok.io