最小termux的nginx+php配置
2022-02-24 本文已影响0人
xnllc
具体流程:
1. 安装nginx: pkg install nginx
2. 启动:nginx

3. 安装PHP: pkg install php
4. 安装php-fpm: pkg install php-fpm
5. 编辑修改php-fpm配置: nano $PREFIX/etc/php-fpm.d/www.conf

6. 编辑修改nginx配置:nano $PREFIX/etc/nginx/nginx.conf
a. 添加php默认首页

b. 配置location ~ .php$内容:


7. 启动php-fpm服务: php-fpm

启动时候有这么个报错,不影响,先忽略吧。
8. 启动nginx或重启nginx: nginx -s reload
9. 添加测试数据页面: echo '<?php phpinfo(); ?>' > $PREFIX/share/nginx/html/info.php ,访问路径为 http://192.168.0.52:8080/info.php 显示如图:

问题:如果输入链接直接下载文件,可能多刷新一下就好了。没有配置好或者配置没有生效会出现这个问题。

---- 分割线 ---
查看nginx运行情况:ps -ef | grep nginx
ps -ef | grep nginx
u0_a307$ ps -ef | grep nginx
u0_a307 28687 1 0 1970 ? 00:00:00 nginx: master process nginx
u0_a307 28688 28687 0 1970 ? 00:00:00 nginx: worker process
u0_a307 29420 28709 0 1970 pts/2 00:00:00 grep --color=auto nginx
查看运行进程:ps -ef