欢迎来到云服务器

系统配置

Centos6.5 基于nginx搭建owncloud

rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

yum --enablerepo=remi -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre pcre-devel

yum --enablerepo=remi install -y php  php-fpm php-mysql php-common php-devel php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-dom php-xmlwriter php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel redis php-pecl-redis

vi /etc/php-fpm.d/www.conf

;env[HOSTNAME] = $HOSTNAME

;env[PATH] = /usr/local/bin:/usr/bin:/bin

;env[TMP] = /tmp

;env[TMPDIR] = /tmp

;env[TEMP] = /tmp

将以上几行前的;去掉并保存

chown -R root:nginx /var/lib/php/session

service php-fpm start

5,部署owncloud

wget https://download.owncloud.org/community/owncloud-8.2.2.tar.bz2

tar jxvf owncloud-8.2.2.tar.bz2 -C /usr/share/nginx/html

chown -R nginx:nginx /usr/share/nginx/html/owncloud/

mkdir -p /usr/share/nginx/html/owncloud/data

chown -R nginx:nginx /usr/share/nginx/html/owncloud/data

6,cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bk

vi /etc/nginx/conf.d/default.conf   用以下内容替换原内容

upstream php-handler {

  server 127.0.0.1:9000;

  #server unix:/var/run/php5-fpm.sock;

  }

server {

  listen 80;

  server_name localhost;

  # Path to the root of your installation

  root /usr/share/nginx/html/owncloud/;

  # set max upload size

  client_max_body_size 10G;

  fastcgi_buffers 64 4K;

  # Disable gzip to avoid the removal of the ETag header

  gzip off;

  # Uncomment if your server is build with the ngx_pagespeed module

  # This module is currently not supported.

  #pagespeed off;

  rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;

  rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;

  rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;

  index index.php;

  error_page 403 /core/templates/403.php;

  error_page 404 /core/templates/404.php;

  location = /robots.txt {

    allow all;

    log_not_found off;

    access_log off;

    }

  location ~ ^/(?:.htaccess|data|config|db_structure.xml|README){

    deny all;

    }

  location / {

  # The following 2 rules are only needed with webfinger

  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;

  }

  location ~ .php(?:$|/) {

  fastcgi_split_path_info ^(.+.php)(/.+)$;

  include fastcgi_params;

  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

  fastcgi_param PATH_INFO $fastcgi_path_info;

  fastcgi_pass php-handler;

  }

  # Optional: set long EXPIRES header on static assets

  location ~* .(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {

      expires 30d;

      # Optional: Don't log access to assets

        access_log off;

  }

  }

使用redis做本地缓存

vi /usr/share/nginx/html/owncloud/config/config.php

添加

  'redis' => array(

     'host' => 'localhost',

     'port' => 6379,

     'timeout' => 0.0,

      ),

service redis start

7,测试

浏览器输入http://yourserverip

admin    (自定义用户名)

password  (自定义密码)

MYSQL    (选择mysql)

admin    (之前建立的数据库账号)

hello    

owncloud

localhost

安装后进入网盘,enjoy it!这里没能用https,还是建议加上ssl比较安全。

腾讯云代理

Copyright © 2003-2021 MFISP.COM. 国外vps服务器租用 梦飞云服务器租用 版权所有 粤ICP备11019662号