您尚未登录。

#1 2015-03-20 18:48:01

roadgo
会员
注册时间: 2012-04-07
帖子: 380

使用opensssl加密 owncloud(我的云盘之路二)

#leafpad /home/qwer/owncloud/config/config.php
加入这个

  'trusted_domains' => 
  array (
    '127.0.0.1',
    'zzd.org',
    '192.168.1.8',
  ),

“zzd.org“指浏览器中输入的域名(也可以你自己定义)
#pacman -S openssl
#mkdir /home/qwer/owncloud/ssl
#cd /home/qwer/owncloud/ssl
现在创建服务器的私钥:
# openssl genrsa -out server.key 2048
你也可以创建一个密码密钥,但是需要每次启动输入:
#openssl genrsa -des3 -out server.key 2048
创建证书签名请求(CSR):
#openssl req -new -key server.key -out server.csr -sha256
最后签名的证书使用上述私钥和CSR:
#openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
改权限给http
# chown -R http:http /home/qwer/owncloud/ssl
发现nginx起动不了:
这种情况可能是在设置私钥key时将密码设置写入了key文件,导致Nginx/Apache等系列服务器在启动时要求Enter PEM pass phrase。我们需要做的是剥离这个密码,利用如下OpenSSL命令生成server.key.unsecure文件:1   
#openssl rsa -in server.key -out server.key.unsecure
重新起动nginx
#systemctl restart nginx
#systemctl restart php-fpm

/etc/nginx/nginx.conf文件如下

#user html;
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;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;


    server {
        listen       443 ssl;
        server_name  zzd.org ;
 	ssl_certificate      /home/qwer/owncloud/ssl/server.crt;
 	ssl_certificate_key  /home/qwer/owncloud/ssl/server.key.unsecure;


        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        root   /home/qwer/owncloud;

        location / {
            
            index  index.php;
            rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
            rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
        }

       location ~ \.php(?:$|/)   {
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          #fastcgi_pass 127.0.0.1:9000; (depending on your php-fpm socket configuration)
          fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
          fastcgi_index index.php;
           fastcgi_param HTTPS on;
          include fastcgi.conf;
       }


       location = /favicon.ico {
          log_not_found off;
       }

  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;
    }



        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #   fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

当你浏览器访问时,要接受一个证书。特别是firefox,差点被它骗了。

最近编辑记录 roadgo (2015-03-20 18:49:58)

离线

#2 2015-03-20 18:55:31

roadgo
会员
注册时间: 2012-04-07
帖子: 380

Re: 使用opensssl加密 owncloud(我的云盘之路二)

http://www.willrey.com/support/SSL_Nginx.html
在创建证书时,有问题请看上面的链接
其中,”Common Name    申请证书的域名    www.willrey.com
这一行要注意,必须是你的域名,或者你的用户名。

离线

#3 2015-03-20 23:53:47

atmouse
会员
注册时间: 2011-08-24
帖子: 701

Re: 使用opensssl加密 owncloud(我的云盘之路二)

支持
我想补充下,用easy-rsa 生成会比较方便快捷

还有
坚果云其实挺不错的,我自己用的话没什么机密文件好在意的(其实二次加密下就好了),稳定倒是很重要的。当我看到 https://jianguoyun.com/s/enterprise 下面的中石油,中海油,可以确认至少“稳定100年不动摇”。。。

离线

#4 2015-03-21 12:46:53

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,492
个人网站

Re: 使用opensssl加密 owncloud(我的云盘之路二)

atmouse 说:

坚果云其实挺不错的,我自己用的话没什么机密文件好在意的(其实二次加密下就好了),稳定倒是很重要的。当我看到 https://jianguoyun.com/s/enterprise 下面的中石油,中海油,可以确认至少“稳定100年不动摇”。。。

可是那是企业用户呀。如果是个人用户的话,不能确保 Wuala 那样的状况不会再次发生。

离线

#5 2015-03-21 14:12:07

atmouse
会员
注册时间: 2011-08-24
帖子: 701

Re: 使用opensssl加密 owncloud(我的云盘之路二)

百合仙子 说:
atmouse 说:

坚果云其实挺不错的,我自己用的话没什么机密文件好在意的(其实二次加密下就好了),稳定倒是很重要的。当我看到 https://jianguoyun.com/s/enterprise 下面的中石油,中海油,可以确认至少“稳定100年不动摇”。。。

可是那是企业用户呀。如果是个人用户的话,不能确保 Wuala 那样的状况不会再次发生。

我说的稳定是指中国特色的稳定, 我之前也认为dropbox挺稳定的

最近编辑记录 atmouse (2015-03-21 14:13:00)

离线

#6 2015-03-21 14:20:19

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,492
个人网站

Re: 使用opensssl加密 owncloud(我的云盘之路二)

atmouse 说:

我说的稳定是指中国特色的稳定, 我之前也认为dropbox挺稳定的

哦,那百度网盘不也一样嘛。
一堆课程啊什么的,6.3 节之后是 6.5 节也是常事。

离线

#7 2015-03-21 14:43:38

atmouse
会员
注册时间: 2011-08-24
帖子: 701

Re: 使用opensssl加密 owncloud(我的云盘之路二)

有道理,国内盘多,但是更容易死得快,这可得不偿失,
还有个是,我想尽量忘掉我有个百度账号

对于那种动辄好几tb的网盘,我一般是不相信的。不管是百度或者什么迅雷啊,115啊。限制也比较多,下文件还要客户端我去,问题是还没有api,坚果盘有webdav,对我同步书签还是挺有用的。

现在网速都挺快的,很少需要用到断点续传,除了上传的时候

最近编辑记录 atmouse (2015-03-21 14:47:51)

离线

页脚