Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use lnmp architecture to install nextcloud cloud disk under centos6.5

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

In the past two years, with the major online disks have been closed, Baidu Cloud also began to limit the speed early, and the security of documents is not guaranteed. So you might as well build your own network disk. After looking at it on the Internet, I found that there is a nextcloud that is easier to use. Support for multi-platform clients, support for sharing, easy to use. Support plug-in extension, file preview, online collaboration.

Install nginx

Wget http://nginx.org/download/nginx-1.10.3.tar.gztar-zxf nginx-1.10.3.tar.gz & & cd nginx-1.10.3./configure-- prefix=/usr/local/data/nginx-user=nginx-- group=nginx-- with-pcre-- with-http_stub_status_module-- with-http_ssl_module-- with-http_gzip_static_modulemake & & make install

two。 Install and configure php

Yum install http://rpms.famillecollet.com/enterprise/remi-release-6.rpmyum-- enablerepo=remi-php56 install php php-fpm php-mysql php-gd php-xml php-redis php-libs php-devel php-zlib php-mbstring

Users who run nginx and php-fpm use nginx here

Vim / etc/php-fpm.confuser = nginxgroup = nginxlisten = 127.0.0.1:9000env [HOSTNAME] = $HOSTNAMEenv [path] = / usr/local/bin:/usr/bin:/binenv [TMP] = / tmpenv [TMPDIR] = / tmpenv [TEMP] = / tmp

3. Install mysql

Yum-y install mysql mysql-serverservice mysqld start

4. Build a database, authorize

CREATE DATABASE nextcloud_db;GRANT ALL ON nextcloud_db.* TO 'nextcloud'@'%' IDENTIFIED BY' nextcloud'; / / be sure to add "%", otherwise you can't let anyone upload the file FLUSH PRIVILEGES on the network.

5. Install nextcloud

Wget https://download.nextcloud.com/server/releases/nextcloud-10.0.2.zip-- no-check-certificateunzip nextcloud-10.0.2.zipmv nextcloud / usr/local/data/nginx/html/usr/local/data/nginx/htmlchown-R nginx.nginx

Create a data directory. It is recommended that the data directory not be put together with the web directory.

/ usr/local/data/nginx/html/nextcloud/data

6. Apply for a certificate

For the security of the network disk, it is necessary to use the https certificate. Here, you can apply for a free DV certificate at the Aliyun backend.

7. Configure nginx

Create a virtual host file

Cd / usr/local/data/nginx/confvim nextcloud.confupstream php-handler {server 127.0.0.1 server 9000;} server {listen 80 ssl;server_name cloud.nextcloud.com;ssl_certificate / usr/local/data/nginx/conf/nextcloud.crt;ssl_certificate_key / usr/local/data/nginx/conf/nextcloud.key # adding the following header is mainly for security add_header Strict-Transport-Security "max-age=15768000;includeSubDomains; preload;"; 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;#nextcloud code directory root / usr/local/data/nginx/html/nextcloud/ Location = / robots.txt {allow all;log_not_found off;access_log off;} # in order to support user_webfinger apprewrite ^ / .well-known/host-meta / public.php?service=host-meta last;rewrite ^ / .well-known/host-meta.json / public.php?service=host-meta-json last;# here to support calendars and contacts, it is recommended to add location = / .well-known/carddav {return 301$ scheme://$host/remote.php/dav } location = / .well-known/caldav {return 301$ scheme://$host/remote.php/dav;} # set the maximum size of the uploaded file. Php also has to modify client_max_body_size 512M / core/templates/403.php;error_page core/templates/403.php;error_page buffers 64 4K / core/templates/404.php;# important: forward all requests to location / {rewrite ^ / index.php$uri on index.php } # Security settings prohibit access to sensitive content location ~ ^ / (?: build | tests | config | lib | 3rdparty | templates | data) / {deny all;} location ~ ^ / (?:\. | autotest | issue | indie | db_ | console) {deny all;} location ~ ^ / (?: index | remote | public | cron | core/ajax/update | status | ocs/v [12] | updater/.+ | ocs-provider/.+ | core/templates/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 on;#Avoid sending the security headers twicefastcgi_param modHeadersAvailable true;fastcgi_param front_controller_active true;fastcgi_pass php-handler;fastcgi_intercept_errors on;fastcgi_request_buffering off;} # Security setting, which forbids access to some sensitive content location ~ ^ / (?: updater | ocs-provider) (?: $| /) {try_files $uri/ = 404 * index index.php } # add cache control headers for js and css files location ~ *\. (?: css | js) ${try_files $uri / index.php$uri$is_args$args;add_header Cache-Control "public, max-age=7200"; add_header Strict-Transport-Security "max-age=15768000;includeSubDomains; preload;"; 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;access_log off;} location ~ *\. (?: svg | gif | png | html | ttf | ico | jpg | jpeg) ${try_files $uri / index.php$uri$is_args$args;access_log off;}} vim nginx.confinclude nextcloud.conf;service nginx start

8. Configure php upload size

Vim / etc/php.inimax_execution_time = 0post_max_size = 512Mupload_max_filesize = 512Mservice php-fpm start

9. Configure nextcloud

10.nextcloud configure redis caching

Using Redis as memory cache can effectively improve the running speed of the program.

Curl-O http://download.redis.io/releases/redis-3.2.8.tar.gztar-zxvf redis-3.2.8.tar.gzcd redis-3.2.8/deps/make geohash-int hiredis jemalloc linenoise luacd.. make & & make installcd utils/./install_server.sh

Configure redis

Vim / etc/redis/6379.conf# requirepass foobaredrequirepass ExpvUwNOk9XRawC8bind 192.168.40.200

Start

Redis-server / etc/redis/6379.conf

Configure nextcloud

Cd / usr/local/nginx/html/nextcloud/configvim config.php 'memcache.local' = >'\ OC\ Memcache\ Redis','redis' = > array ('host' = >' 192.168.40.200)

Refresh the page

Set timing

* / 15 * / usr/bin/php / usr/local/nginx/html/nextcloud/cron.php > / dev/null

Reference documentation

Https://docs.nextcloud.com/server/10/admin_manual/installation/index.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report