Ubuntu 搭建 ownCloud

apt-get update
apt-get upgrade
apt-get install -y  gcc make lrzsz unzip libpcre3 libpcre3-dev libpng-dev curl PHP5 PHP5-MysqL PHP5-fpm PHP5-curl PHP5-gd  PHP5-intl  PHP5-mcrypt PHP5-ldap PHP5-imap PHP5-gmp
wget https://www.openssl.org/source/openssl-1.0.2j.tar.gz
wget http://Nginx.org/download/Nginx-1.10.2.tar.gz

分别解压

./configure --with-http_ssl_module --with-http_v2_module --with-openssl=../openssl-1.0.2j/ --with-debug
make && make install

vim /etc/PHP5/fpm/pool.d/www.conf

取消下面这几行的注释

env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

修改 listen

;listen = /var/run/PHP5-fpm.sock
listen = 127.0.0.1:9000

重启服务

service PHP5-fpm restart
cd /usr/local/Nginx/html/
wget https://download.owncloud.org/community/owncloud-9.1.1.zip
unzip owncloud-9.1.1.zip

退回 Nginx 主目录

chown -R www-data html
chgrp -R www-data html

创建 sslkey 目录,把 https 的证书和 key 文件放进去

Nginx.conf 配置文件内容

直接用下面的文件内容覆盖 Nginx.conf 即可

说明:如果不需要 https,
删除第一个 server 块;第二 server 块的 listen 443 ssl; 改成 listen 80;删除 ssl_certificatessl_certificate_key的属性值

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/Nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    
    upstream PHP-handler {
        server 127.0.0.1:9000;
        #server unix:/var/run/PHP5-fpm.sock;
    }
    
    server {
        listen 80;
        server_name test.junbaor.com;
        # enforce https
        return 301 https://$server_name$request_uri;
    }

    server {
        listen 443 ssl;
        server_name test.junbaor.com;

        add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
        ssl_certificate /usr/local/Nginx/sslkey/junbaor.crt;
        ssl_certificate_key /usr/local/Nginx/sslkey/junbaor.key;

        # Add headers to serve security related headers
        # Before enabling Strict-Transport-Security headers please read into this topic first.
        #add_header Strict-Transport-Security "max-age=15552000; includeSubDomains";
        add_header X-Content-Type-Options nosniff;
        add_header x-frame-options "SAMEORIGIN";
        add_header X-XSS-Protection "1; mode=block";
        add_header X-Robots-Tag none;
        add_header X-Download-Options noopen;
        add_header X-Permitted-Cross-Domain-Policies none;

        # Path to the root of your installation
        root /usr/local/Nginx/html/owncloud/;

        location = /robots.txt {
            allow all;
            log_not_found off;
            access_log off;
        }

        # The following 2 rules are only needed for the user_webfinger app.
        # Uncomment it if you're planning to use this app.
        #rewrite ^/.well-kNown/host-Meta /public.PHP?service=host-Meta last;
        #rewrite ^/.well-kNown/host-Meta.json /public.PHP?service=host-Meta-json last;

        location = /.well-kNown/carddav {
            return 301 $scheme://$host/remote.PHP/dav;
        }
        location = /.well-kNown/caldav {
            return 301 $scheme://$host/remote.PHP/dav;
        }

        location /.well-kNown/acme-challenge { }

        # set max upload size
        client_max_body_size 512M;
        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;

        error_page 403 /core/templates/403.PHP;
        error_page 404 /core/templates/404.PHP;

        location / {
            rewrite ^ /index.PHP$uri;
        }

        location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
            return 404;
        }
        location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
            return 404;
        }

        location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.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_param HTTPS on;
            fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
            fastcgi_param front_controller_active true;
            fastcgi_pass PHP-handler;
            fastcgi_intercept_errors on;
            fastcgi_request_buffering off;
        }

        location ~ ^/(?:updater|ocs-provider)(?:$|/) {
            try_files $uri $uri/ =404;
            index index.PHP;
        }

        # Adding the cache control header for js and css files
        # Make sure it is BELOW the PHP block
        location ~* \.(?:css|js)$ {
            try_files $uri /index.PHP$uri$is_args$args;
            add_header Cache-Control "public,max-age=7200";
            # Add headers to serve security related headers (It is intended to have those duplicated to the ones above)
            # Before enabling Strict-Transport-Security headers please read into this topic first.
            #add_header Strict-Transport-Security "max-age=15552000; includeSubDomains";
            add_header X-Content-Type-Options nosniff;
            add_header x-frame-options "SAMEORIGIN";
            add_header X-XSS-Protection "1; mode=block";
            add_header X-Robots-Tag none;
            add_header X-Download-Options noopen;
            add_header X-Permitted-Cross-Domain-Policies none;
            # Optional: Don't log access to assets
            access_log off;
        }

        location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
            try_files $uri /index.PHP$uri$is_args$args;
            # Optional: Don't log access to other assets
            access_log off;
        }
    }
}

ubuntu 搭建 owncloud的更多相关文章

  1. ios – didUpdateLocations从未调用过

    我正在尝试获取用户的位置.为此,我在info.plist中设置了以下属性:我还在viewDidLoad方法中添加了以下代码以及下面的函数.问题是locationManager(manager,didUpdate…

  2. ios – 重命名并重写为Swift后对象解码崩溃

    由于我们已经重命名了(Bestemming–>Place)类并将其从Objective-c重写为Swift,因此一些用户会遇到崩溃.我们正在尝试使用NSCoding原则从NSUserDefaults加载对象.碰撞:班级:从NSUserDefaults阅读:崩溃日志说它在第0行崩溃,这是注释所以我认为它在init方法中崩溃,我认为它与一个null为空但不能为null的对象有关.我尝试过的:>尝试在S

  3. 适用于iOS的Google Maps SDK不断增加内存使用量

    我已经构建了一个在地图上显示标记的简单应用程序,我从服务器的JSON文件加载其x,y,标记是可点击的,所以一旦你在任何标记上它将你带到另一个UIViewController(我们将它命名为BViewController).我已经监视了内存使用情况,所以每次我从BViewController返回到MapViewController(里面的地图)时,它只是内存使用量的两倍我尝试将其设置为nill或从s

  4. ios – 未提示在应用程序中启用位置服务

    更新:这不是重复.我已经在info.plist中添加了所需的密钥,如我原始问题中所述,问题仍然存在.我已经尝试了各种组合的所有三个键.在任何人感到不安之前,我已阅读了许多AppleDev论坛帖子和堆栈溢出帖子,无法弄清楚为什么我的应用程序拒绝提示用户允许使用时授权.我已将以下密钥添加到我的Info.plist文件中,并附带一个String值:然后我写了(在Swift和Obj-C中)应该提示用户的代

  5. ios – 在UIViewController显示为3DTouch预览时检测UITouches

    是否有可能从UIViewController检测触摸并获取触摸的位置,UIViewController当前用作3DTouch的previewingContext视图控制器?

  6. ios – Google地图折线不完美呈现

    我正在使用最新的GoogleMapsAPIforiOS绘制折线.我正在逐点构造折线,但是当我缩小折线从地图中消失(不是字面上的术语)时,它不能正常渲染,当我放大时,它只会显示线条.这是放大时折线的显示方式这是缩小时的显示方式这里是我绘制折线的功能我有覆盖init:为RCpolyline是这样的东西和drawpolylineFromPoint:toPoint:这样做解决方法我发现这个故障,我正在制作

  7. ios – CLGeocoder错误. GEOErrorDomain代码= -3

    有没有关于apple的地理编码请求的文档?谢谢你提前.更新这是我的整个代码请求解决方法在搜索到答案后,它在Apples文档中!

  8. ios – Sprite Kit – 确定滑动精灵的滑动手势向量

    我有一个游戏,圆形物体从屏幕底部向上射击,我希望能够滑动它们以向我的滑动方向轻弹它们.我的问题是,我不知道如何计算滑动的矢量/方向,以便使圆形物体以适当的速度在正确的方向上被轻弹.我正在使用的静态矢量“(5,5)”需要通过滑动的滑动速度和方向来计算.此外,我需要确保一旦我第一次接触到对象,就不再发生这种情况,以避免双重击中对象.这是我目前正在做的事情:解决方法以下是如何检测滑动手势的示例:首先,定

  9. ios – 如何使用Swift使用Core Data更新/保存和保留非标准(可转换)属性?

    我已经构建了一个非常基本的示例来演示我尝试更新可转换类型并在应用程序重新启动之间保持更改的问题.我有一个Destination类型的实体……解决方法核心数据无法跟踪该对象的脏状态,因为它不了解其内部.而不是改变对象,创建一个副本,改变它,然后设置新对象.它可能会变异,然后重新设置相同的对象,不确定,没有测试它.您可以检查,只是改变地址,然后询问托管对象是否有更改,如果没有则则不会保存.

  10. iOS检测模拟位置

    我假设一个封闭的目标,攻击者必须是开发人员才能使这个漏洞利用起来,但是唉,它仍然存在解决方法问题:有没有办法检测到这种行为并阻止它?实际上有两个独立的问题:如何检测,以及如何预防?

随机推荐

  1. crontab发送一个月份的电子邮件

    ubuntu14.04邮件服务器:Postfixroot收到来自crontab的十几封电子邮件.这些邮件包含PHP警告.>我已经解决了这些警告的原因.>我已修复每个cronjobs不发送电子邮件(输出发送到>/dev/null2>&1)>我删除了之前的所有电子邮件/var/mail/root/var/spool/mail/root但我仍然每小时收到十几封电子邮件.这些电子邮件来自cronjobs,

  2. 模拟两个ubuntu服务器计算机之间的慢速连接

    我想模拟以下场景:假设我有4台ubuntu服务器机器A,B,C和D.我想在机器A和机器C之间减少20%的网络带宽,在A和B之间减少10%.使用网络模拟/限制工具来做到这一点?

  3. ubuntu-12.04 – 如何在ubuntu 12.04中卸载从源安装的redis?

    我从源代码在Ubuntu12.04上安装了redis-server.但在某些时候它无法完全安装,最后一次makeinstallcmd失败.然后我刚刚通过apt包安装.现在我很困惑哪个安装正在运行哪个conf文件?实际上我想卸载/删除通过源安装的所有内容,只是想安装一个包.转到源代码树并尝试以下命令:如果这不起作用,您可以列出软件自行安装所需的步骤:

  4. ubuntu – “apt-get source”无法找到包但“apt-get install”和“apt-get cache”可以找到它

    我正在尝试下载软件包的源代码,但是当我运行时它无法找到.但是当我运行apt-cache搜索squid3时,它会找到它.它也适用于apt-getinstallsquid3.我使用的是Ubuntu11.04服务器,这是我的/etc/apt/sources.list我已经多次更新了.我尝试了很多不同的debs,并没有发现任何其他地方的错误.这里的问题是你的二进制包(deb)与你的源包(deb-src)不

  5. ubuntu – 有没有办法检测nginx何时完成正常关闭?

    &&touchrestarted),因为即使Nginx没有完成其关闭,touch命令也会立即执行.有没有好办法呢?这样的事情怎么样?因此,pgrep将查找任何Nginx进程,而while循环将让它坐在那里直到它们全部消失.你可以改变一些有用的东西,比如睡1;/etc/init.d/Nginx停止,以便它会休眠一秒钟,然后尝试使用init.d脚本停止Nginx.你也可以在某处放置一个计数器,这样你就可以在需要太长时间时发出轰击信号.

  6. ubuntu – 如何将所有外发电子邮件从postfix重定向到单个地址进行测试

    我正在为基于Web的应用程序设置测试服务器,该应用程序发送一些电子邮件通知.有时候测试是使用真实的客户数据进行的,因此我需要保证服务器在我们测试时无法向真实客户发送电子邮件.我想要的是配置postfix,以便它接收任何外发电子邮件并将其重定向到一个电子邮件地址,而不是传递到真正的目的地.我正在运行ubuntu服务器9.10.先感谢您设置本地用户以接收所有被困邮件:你需要在main.cf中添加:然后

  7. ubuntu – vagrant无法连接到虚拟框

    当我使用基本的Vagrantfile,只配置了两条线:我看到我的虚拟框打开,但是我的流氓日志多次显示此行直到超时:然后,超时后的一段时间,虚拟框框终于要求我登录,但是太久了!所以我用流氓/流氓记录.然后在我的物理机器上,如果我“流氓ssh”.没有事情发生,直到:怎么了?

  8. ubuntu – Nginx – 转发HTTP AUTH – 用户?

    我和Nginx和Jenkins有些麻烦.我尝试使用Nginx作为Jenkins实例的反向代理,使用HTTP基本身份验证.它到目前为止工作,但我不知道如何传递带有AUTH用户名的标头?}尝试将此指令添加到您的位置块

  9. Debian / Ubuntu – 删除后如何恢复/ var / cache / apt结构?

    我在ubuntu服务器上的空间不足,所以我做了这个命令以节省空间但是现在在尝试使用apt时,我会收到以下错误:等等显然我删除了一些目录结构.有没有办法做apt-getrebuild-var-tree或类似的?

  10. 检查ubuntu上安装的rubygems版本?

    如何查看我的ubuntu盒子上安装的rubygems版本?只是一个想法,列出已安装的软件包和grep为ruby或宝石或其他:)dpkg–get-selections

返回
顶部