在OrangePi Zero上使用Lighttpd+SQLite+PHP7搭建OwnCloud
一、刷写系统
给orange pi zero刷写armbian系统,基于ubuntu 16.04 lts版
二、安装环境
安装lighttpd+sqlite3+php7环境
1、升级
sudo apt-get update
2、安装lighttpd
sudo apt install lighttpd
3、安装sqlite3
sudo apt install sqlite3
4、安装php7
sudo apt install php7.0-fpm\
php7.0-gd php7.0-json php7.0-sqlite3 php7.0-curl \
php7.0-intl php7.0-mcrypt php-imagick \
php7.0-zip php7.0-xml php7.0-mbstring
5、安装owncloud所需额外拓展
sudo apt-get install php-apcu php-redis redis-server \
php7.0-ldap php-smbclient
三、配置环境
1、配置php
编辑/etc/php/7.0/fpm/php.ini
文件,取消cgi.fix_pathinfo=1
前注释
2、配置lighttpd
cd /etc/lighttpd/conf-available/
cp 15-fastcgi-php.conf 15-fastcgi-php.conf.bak
nano 15-fastcgi-php.conf
将15-fastcgi-php.conf
修改为
# /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi
## Start an FastCGI server for php (needs the php7.0-cgi package)
fastcgi.server += ( ".php" =>
((
"socket" => "/var/run/php/php7.0-fpm.sock",
"broken-scriptfilename" => "enable"
))
)
启用fastcgi配置
lighttpd-enable-mod fastcgi
lighttpd-enable-mod fastcgi-php
这将创建符号链接将/etc/lighttpd/conf-enabled/10-fastcgi.conf
指向/etc/lighttpd/conf-available/10-fastcgi.conf
和/etc/lighttpd/conf-enabled/15-fastcgi-php.conf
指向/etc/lighttpd/conf-available/15-fastcgi-php.conf
,运行下面命令检查结果
ls -l /etc/lighttpd/conf-enabled
重载lighttpd
sudo service lighttpd force-reload
3、启用SSL
mkdir certs
cd /etc/lighttpd/certs
openssl req -new -x509 -keyout lighttpd.pem -out lighttpd.pem -days 365 -nodes
chmod 400 lighttpd.pem
先备份/etc/lighttpd/conf-available/10-ssl.conf
cp /etc/lighttpd/conf-available/10-ssl.conf /etc/lighttpd/conf-available/10-ssl.conf.bak
编辑/etc/lighttpd/conf-available/10-ssl.conf
$SERVER["socket"] == ":443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/lighttpd/certs/lighttpd.pem"
}
启用lighttpd的SSL模块
lighttpd-enable-mod ssl
/etc/init.d/lighttpd force-reload
systemctl restart lighttpd.service
四、安装OwnCloud
1、下载
用wget从官网下载ownCloud Server Archive File到/var/www/html/
2、解压
3、修改目录权限
把owncloud目录的给HTTP user,armbian系统默认为www-data
chown -R www-data:www-data /var/www/html/owncloud/
4、打开http://ip/owncloud 安装即可
五、其他修复
1、环境变量修复
提示“PHP似乎没有设置好查询的系统环境变量。用getenv("PATH")测试只返回一个空值。”
打开php安装目录下的php-fpm.conf
nano /etc/php/7.0/fpm/php-fpm.conf
添加
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
参考资料
Manual Installation on Linux — ownCloud 10.0.4 Server Administration Manual 10.0.4 documentation
在Ubuntu 16.04 LTS上使用PHP 7(PHP-FPM)和MySQL 5.7安装Lighttpd
Ubuntu 16.04安装Lighttpd(PHP+MySQL) – WTF Daily Blog
HowToSimpleSSL - Lighttpd - lighty labs
lighttpd+php+https+mysql+树莓派搭建属于自己的owncloud私有云盘 - 简书
折腾树莓派(三)使用ownCloud建立私有云 - CSDN博客
PHP 似乎没有设置好查询的系统环境变量。 用 getenv(”PATH”) 测试只返回一个空值。 | 姜维博客