小老外在为小学安装云储存功能,环境如下:
CentOS 6.4
Nginx 1.5.1
php-fpm 5.4.16
MariaDB 5.5.31
ownCloud 5.0.7
在安装好php-fpm以及配套php插件后,配置好nginx下的owncloud.conf文件后出现了个登录无限循环的错误。在error.log中只是显示PHP message: PHP Fatal error: Access to undeclared static property: OC::$CLASSPATH in / var/www/oc/lib/base.php 的错误。经过一下午的几番捣鼓最终才明白,在新搭建环境下,必须在/var/lib/php下创建一个session的文件夹,并且chmod 777 session。至此,问题才解决。这个文件夹不解决,phpmyadmin也会无法访问。
同时在这里上传一下我的owncloud.conf:
# redirect http to https.
server {
listen 80 default;
server_name p.example.org;
rewrite ^ https://$server_name$request_uri? permanent; # enforce https
}
# owncloud (ssl/tls)
server {
listen 443 ssl;
server_name p.example.org;
#allow 127.0.0.1;
#deny all;
ssl_certificate /etc/nginx/certs/oc.crt;
ssl_certificate_key /etc/nginx/certs/oc.key;
root /var/www/owncloud;
client_max_body_size 1G; # set max upload size
fastcgi_buffers 64 4K;
rewrite ^/caldav((/|$).*)$ /remote.php/caldav$1 last;
rewrite ^/carddav((/|$).*)$ /remote.php/carddav$1 last;
rewrite ^/webdav((/|$).*)$ /remote.php/webdav$1 last;
index index.php;
error_page 403 = /core/templates/403.php;
error_page 404 = /core/templates/404.php;
# deny direct access
location ~ ^/(data|config|\.ht|db_structure\.xml|README) {
deny all;
}
# default try order
location / {
rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
try_files $uri $uri/ index.php;
}
# enable php
location ~ ^(?<script_name>.+?\.php)(?<path_info>/.*)?$ {
try_files $script_name = 404;
include fastcgi.conf;
fastcgi_param PATH_INFO $path_info;
# fastcgi_param HTTPS on;
fastcgi_pass 127.0.0.1:9000;
}
location ~* ^.+.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
# Optional: Don't log access to assets
access_log off;
}
}