安装nginx,参考Armbian-N1源码安装Nginx
1. 安装php7.2
sudo apt-get install php7.2
sudo apt-get install php7.2-fpm php7.2-mysql php7.2-curl php7.2-json php7.2-mbstring php7.2-xml php7.2-intl php7.2-gd
若armbian中没有软件源,报错Unable to locate package php7.2
,需要先添加软件源:
apt install ca-certificates apt-transport-https -y
wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | tee /etc/apt/sources.list.d/php.list
apt update
然后再进行安装。
2. 配置php-frm
1. fpm.ini配置文件路径:/etc/php/7.2/fpm/php.ini
- 778行
;cgi.fix_fathinfo=1
更改为cgi.fix_fathinfo=0
(去掉注释;)
2. www.conf
文件路径:/etc/php/7.2/fpm/pool.d/www.conf
- 36行
listen = /run/php/php7.2-fpm.sock
修改为:listen = 127.0.0.1:9900
(9000被别的占用了) - 62行
listen.allowed_clients = 127.0.0.1
注释去掉 - 113行
pm.max_children = 50
- 139行
pm.max_requests = 500
- 344行
rlimit_files = 1024
3. 重启php服务
systemctl restart php7.2-fpm
systemctl enable php7.2-fpm
# 查询是否启动成功
ps -ef |grep php-fpm
4. 配置 nginx可解析 .php文件
修改/usr/local/nginx/conf/nginx.conf
文件中 server{} 配置:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm index.php;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9900; # 这里和上面修改的www.conf文件中listen的值要一致
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
重启nginx:systemctl restart nginx
5. 测试nginx和php是否配置成功
在/usr/local/nginx/html
中创建test.php,里面内容如下
<?php phpinfo(); ?>
浏览器输入http://ip/test.php
访问,如下图
3. 安装可道云
- 官网下载个人版的
下载地址
解压上传 - nginx配置代理
server { listen 8610; server_name localhost; location / { root /mnt/sda1/kodexplorer; index index.php index.html index.htm; } location ~ \.php$ { root /mnt/sda1/kodexplorer; fastcgi_pass 127.0.0.1:9900; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
重启nginx:systemctl restart nginx
访问地址:http://IP:8610
网友评论