随身 WIFI 板子安装 LNMP 教程

装 LNMP,准备工作

随身 WIFI 板子安装 LNMP 教程
# 连 wifi
nmtui
# 更新源
apt-get update
# 装 ssl 证书
sudo apt install apt-transport-https ca-certificates
# 修改源文件权限 使其能用 xftp 直接编辑
chmod 777 /etc/apt/sources.list

sources.list 源内容,可根据个人喜好选择源

# deb http://mirrors.163.com/debian/ bullseye main contrib non-free
# deb http://security.debian.org/ bullseye-security main contrib non-free
# 默认注释了源码镜像以提高 apt update 速度
# 清华大学的软件源
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free 
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free 
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free 
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free 
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free 
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free 
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free 
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

# 阿里云的软件源
# deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
# deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
# deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
# deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
# deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
# deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
# deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
# deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib

# 中科大的软件源
# deb https://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free 
# deb-src https://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free 
# deb https://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free 
# deb-src https://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free 
# deb https://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free 
# deb-src https://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free 
# deb https://mirrors.ustc.edu.cn/debian-security bullseye-security main contrib non-free 
# deb-src https://mirrors.ustc.edu.cn/debian-security bullseye-security main contrib non-free

继续执行命令安装 PHP、Nginx

apt-get update
apt-get upgrade
# 安装 PHP 拓展
sudo apt-get install -y php php-fpm php-curl php-gd php-intl php-mbstring php-mysql php-imap php-opcache php-sqlite3 php-xml php-xmlrpc php-zip
# 查看 php 版本 验证是否成功
php -v
sudo apt-get install nginx
# 验证 nginx 是否成功 安装 curl、nano 编辑器、wget
apt-get install curl nano wget
curl 127.0.0.1
# 找到 index 配置,添加 index.php
sudo nano /etc/nginx/sites-enabled/default

找到# pass PHP scripts to FastCGI server 后面的 location 删除注释如下

location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
# # With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
}

重启 nginx 验证 php

sudo systemctl restart nginx
sudo nano /var/www/html/phpinfo.php

新建 phpinfo.php 文件验证,文件内容为

<?php
phpinfo();

电脑浏览器访问:http://192.168.68.1/phpinfo.php 即可看到 PHP 探针信息。

安装 MySql

sudo apt-get install mariadb-server mariadb-client
sudo mysql_secure_installation
# 参考
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
# 将 bind-address 这行注释掉
# 或者将 127.0.0.1 这个值改为  0.0.0.0
# 然后重启
sudo systemctl restart mariadb.service

设置远程访问权限

mysql -u root -p
use mysql;
# 例如账号 root 密码 rootpwd
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'rootpwd' WITH GRANT OPTION;
flush privileges;
# ctrl + c 退出界面,执行命令重启服务
sudo systemctl restart mariadb.service
# 查看 mysql 服务状态
sudo systemctl status mariadb.service

安装 Z -Blog 示例

cd /var/www/html/
# 上传程序包到该目录
wget https://update.zblogcn.com/zip/Z-BlogPHP_1_7_2_3060_Tenet.zip
unzip Z-BlogPHP_1_7_2_3060_Tenet.zip
# 返回上一级,将网站目录文件全部授权 777(个人之便)
cd ..
chmod -R 777 ./html

然后访问:http://192.168.68.1 即可安装网站程序。执行命令:ip addr 获取棒子连接 WIFI 的地址,记下来会用到。
拔掉随身 WIFI 随便插在某个插头上,等几分钟后访问 ip addr 获取的 ip 即可访问网站。
后续也可以内网穿透来公网访问,根据个人喜好来安装吧!

手机扫描二维码访问

本文标题:《随身 WIFI 板子安装 LNMP 教程》作者:极四维博客
原文链接:https://cway.top/post/1061.html
特别注明外均为原创,转载请注明。

分享到微信

扫描二维码

可在微信查看或分享至朋友圈。

相关文章

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

«    2024年10月    »
123456
78910111213
14151617181920
21222324252627
28293031

搜索

控制面板

您好,欢迎到访网站!
  查看权限

最新留言

文章归档

  • 订阅本站的 RSS 2.0 新闻聚合