最近两年随着各大网盘纷纷关闭,百度云也早早的就开始限速,文件的安全也没有保障。所以还不如自己搭建一个网盘。网上看了下,发现有一个nextcloud比较好用。支持多平台客户端,支持分享,使用操作简单。支持插件扩展,文件预览,在线协作。
- <李>
安装nginx
李>wget http://nginx.org/download/nginx-1.10.3.tar.gz tar -zxf  nginx-1.10.3.tar.gz ,, cd nginx-1.10.3 。/configure ——prefix=/usr/地方/数据/nginx ——用户=nginx ——组=nginx ——with-pcre ——with-http_stub_status_module ——with-http_ssl_module ——with-http_gzip_static_module make ,,, make 安装
2。安装配置php
yum install http://rpms.famillecollet.com/enterprise/remi -释放- 6. - rpm yum ——enablerepo=remi-php56 install  php php-fpm php-mysql php-gd php-xml php-redis php-libs php-devel php-zlib php-mbstring
nginx和php-fpm的运行用户这里使用nginx
vim /etc/php-fpm.conf user =nginx group =nginx listen =127.0.0.1:9000 env(主机名),美元=,主机名 env(路径),=,/usr/地方/bin:/usr/bin:/bin env (TMP),=,/TMP env (TMPDIR],=,/tmp env(临时),=,/tmp
3。安装mysql
yum -y install mysql mysql服务器 service mysqld 开始
4。建库,授权
CREATE DATABASE nextcloud_db; GRANT ALL 提醒nextcloud_db。*,用“nextcloud”@“%”, IDENTIFIED BY nextcloud,,//注意一定要加,“%”,否则无法让网络让任何人上传文件 FLUSH 特权;
5。安装nextcloud
wget https://download.nextcloud.com/server/releases/nextcloud-10.0.2.zip ——no-check-certificate unzip nextcloud-10.0.2.zip mv nextcloud /usr/地方/数据/nginx/html/usr/local/data/nginx/html chown -R  nginx。nginx
/usr/地方/数据/nginx/html/nextcloud/
6。申请证书
为了网盘的安全,有必要使用https证书,这里可以在阿里云后台申请免费的DV证书
7。配置nginx
创建虚拟主机文件
cd /usr/nginx/conf/地方/数据 vim nextcloud.conf upstream php-handler  { server 127.0.0.1:9000; }server {listen 80; server_name cloud.nextcloud.com; return 301, https://server_name request_uri美元;}server {listen 443, ssl; server_name cloud.nextcloud.com; ssl_certificate /usr/地方/数据/nginx/conf/nextcloud.crt; ssl_certificate_key /usr/地方/数据/nginx/conf/nextcloud.key; #添加如下头主要为了安全 add_header Strict-Transport-Security “信息=15768000;includeSubDomains;,预加载;”;add_header X-Content-Type-Options nosniff; add_header X-Frame-Options “SAMEORIGIN”; add_header X-XSS-Protection “1;,模式=块”;add_header X-Robots-Tag 没有;add_header X-Download-Options noopen; add_header X-Permitted-Cross-Domain-Policies 没有; # nextcloud代码目录 root /usr/地方/数据/nginx/html/nextcloud/; 位置=,/robots.txt {allow ; log_not_found ; access_log ;} #为了支持user_webfinger 应用 rewrite ^/.well-known/host-meta /public.php ?服务=host-meta 去年; rewrite ^/.well-known/host-meta.json /public.php ?服务=host-meta-json 去年; #这儿是为了支持日历和联系人,建议加上 位置=,/.well-known/carddav {return 301,美元方案://主机/remote.php/dav;美元}位置=,/.well-known/caldav {return 301,美元方案://主机/remote.php/dav美元;} #设置上传文件的最大大小,php也得修改 client_max_body_size 512; fastcgi_buffers 64, 4 k; #, Disable gzip 用avoid 从而removal of 从而ETag headergzip ; error_page 403, 403./核心/模板/php; error_page 404年,/核心php/模板/404.; #重要的:将所有请求转发到index . php上 位置/,{^ rewrite 美元/index . php的uri; } #安全设置,禁止访问部分敏感内容 位置~,^/(?:构建自由| 3 | |测试配置| rdparty | |模板数据)/,{deny 所有;}位置~,^/(?:\ | autotest | occ | |独立问题| db_ |控制台),{deny 所有;}位置~,^/(?:索引远程公共| | | cron |核心/ajax/商务/v[12]更新状态| | |更新器/? | ocs-provider/? |核心/模板/40 [34])\。php(?: |/美元),{include fastcgi_params fastcgi_split_path_info ^ (. + \。php)(/. *)美元;fastcgi_param SCRIPT_FILENAME document_root fastcgi_script_name美元;fastcgi_param PATH_INFO fastcgi_path_info美元;fastcgi_param HTTPS ; # Avoid sending 从而security headers twicefastcgi_param modHeadersAvailable 真实;fastcgi_param front_controller_active 真实;fastcgi_pass php处理;fastcgi_intercept_errors ; fastcgi_request_buffering ; } #安全设置,禁止访问部分敏感内容 null null null null null null null null null null null null null null null null null null null null null null null null null null null null nullcentos6.5下使用lnmp架构安装nextcloud云盘