一聚教程网:一个值得你收藏的教程网站

热门教程

centos中Nginx安装Pydio基本设置详解

时间:2022-06-30 18:27:10 编辑:袖梨 来源:一聚教程网

目前有好多的云存储的服务,如百度云、360云、Dropbox之类,虽然国产的云提供了大空间存储,但是总是有点怪异,目前百度云在下载方面出现了限速的行为,非要开通会员才能全速下载,弄得几百兆的宽带只能以200kb的速度下载,非常的不舒服。 Dropbox和OneDrive都是国外的云服务,还有GoogleDrive之类,虽然给的空间比较小,但也都是良心之作,Dropbox算是我用的最好用的存储服务了。但就是需要配合SS用,OneDrive虽然在国内可用,但是用不习惯。


 国外云存储 前段时间在网络上游荡的时候发现国外有一款比较好的私人存储Pydio,不过是需要拥有自己的服务器或者主机才行,而手头恰好有一台空的VPS,于是就用来安装Pydio。在Pydio的官方文档中提供了Apache的安装设置方法,没有Nginx的,采用默认的方式安装,将Pydio的安装包解压到目录下,一路就可以安装完成,但是会出现两个问题: 页面再次刷新会404; Windows客户端连接不上; 其中在Windows客户端连接时会出现: Error while trying to connect to http://xxx.xxx.xx : Server not found (404), is it up and has it Pydio installed ? 根据判断,应该是Nginx的重定向没有设置好,需要重新设置网站的conf配置文件。在论坛上四处搜寻了一下,发现出现这个问题的人不少,于是再次求助于官方文档,在官方的一个文章中找到了一个在Debian的Nginx环境下的配置方法,结合lnmp的配置文件,自己改动了一下,顺利完成了重定向的配置,下面贴出了具体的配置文件,以防忘记:


server
 {
  listen 80;
  server_name cloud.defel.net;
  # enforce https
  return 301 https://$server_name$request_uri;
  add_header X-Frame-Options "SAMEORIGIN";
 }
server
    {
        listen 443 ssl;
        #listen [::]:80;
        server_name cloud.defel.net;
        index index.html index.htm index.php default.html default.htm default.php;
  ### If you changed the maximum upload size in PHP.ini, also change it below
  client_max_body_size 5120M;
  # Prevent Clickjacking
  add_header X-Frame-Options "SAMEORIGIN";
        root  /home/wwwroot/cloud.defel.net;
  ssl_certificate /etc/pki/tls/certs/1_cloud.defel.net_bundle.crt;
  ssl_certificate_key /etc/pki/tls/certs/2_cloud.defel.net.key;
  add_header Strict-Transport-Security "max-age=16070400; includeSubdomains";
  
        include other.conf;
  rewrite ^/dashboard|^/settings|^/welcome|^/ws- /index.php last;
  if ( !-e $request_filename ) {
    # WebDAV Rewrites
    rewrite ^/shares /dav.php last;
    # Sync client
    rewrite ^/api /rest.php last;
    # External users
    rewrite ^/user ./index.php?get_action=user_access_point last;
    # Public shares
    rewrite ^/data/public/([a-zA-Z0-9_-]+).php$ /data/public/share.php?hash=$1?;
  }
  rewrite ^/data/public/([a-zA-Z0-9_-]+)--([a-z]+)$ /data/public/share.php?hash=$1&lang=$2?;
  rewrite ^/data/public/([a-zA-Z0-9_-]+)$ /data/public/share.php?hash=$1?;
        #error_page   404   /404.html;
  # Remove direct access to the following folders & files
  location ~* ^/(?:.|conf|data/(?:files|personal|logs|plugins|tmp|cache)|plugins/editor.zoho/agent/files)
  {
   deny all;
  }
  location ~* /data/public/.*.(ser|htaccess)$
  {
   deny all;
  }
  # Stops the annoying error messages in the logs
  location ~* ^/(favicon.ico|robots.txt)
  {
   log_not_found off;
  }
  # WebDAV Rewrites
  location /shares
  {
   if (!-f $request_filename) {
     rewrite ^/shares /dav.php last;
     break;
   }

   if (!-d $request_filename) {
     rewrite ^/shares /dav.php last;
     break;
   }
  }
  # Enables PHP
        location ~ .php$
        {
            # comment try_files $uri =404; to enable pathinfo
            try_files $uri =404;
   fastcgi_param HTTPS on;
   set $request_url $request_uri;
   if ( $uri ~ ^/(index|plugins) )
   {
    set $request_url /;
   }
            fastcgi_pass  unix:/tmp/php-cgi.sock;
   fastcgi_param  REQUEST_URI $request_url;
            fastcgi_index index.php;
            include fastcgi.conf;
   include fastcgi_params;
            #include pathinfo.conf;
        }
  # Enables Caching
  location ~* .(jpg|jpeg|png|gif|ico|css|js)$
  {
   expires 7d;
   add_header Pragma public;
   add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  }

        access_log  /home/wwwlogs/cloud.defel.net.log  access;
    }

这里的配置文件是启用了SSL加密的,也是官方推荐的,如果不需要启动,则需要进行几点改动: 删除重定向部分; 修改监听端口443为80; 删除SSL证书两行; 同时这个是启用了日志功能的,也是可以关闭的,另外其他域名使用需要修改配置文件中的域名。 PS:修改上传大小可以再php.ini中修改:

 vi /etc/php.ini

找到下面进行修改:

[...]
upload_max_filesize = 1024M
[...]
post_max_size = 1024M
[...]
output_buffering = Off
[...]

 

热门栏目