4-30 0 views
环境
PHP: php72
NextCloud: 20.0.6
安装NextCloud
安装
1 2 3 4 5 6 7 8 9 |
# 下载nextcloud wget https://download.nextcloud.com/server/releases/nextcloud-20.0.6.zip # 解压,并配置权限 unzip -o nextcloud-20.0.6.zip -d /storage/apps/ ln -s /storage/apps/nextcloud /storage/apps/html cd /storage/apps/nextcloud chown nginx:nginx -R /storage/apps/nextcloud |
安装PHP72
1 2 3 4 |
yum install -y epel-release yum-utils unzip curl wget bash-completion policycoreutils-python mlocate bzip2 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm yum install -y nginx php72w-fpm php72w-cli php72w-gd php72w-mcrypt php72w-mysql php72w-pear php72w-xml php72w-mbstring php72w-pdo php72w-json php72w-pecl-apcu php72w-pecl-apcu-devel php72w-ldap php72w-intl |
配置PHP-FPM
> vim /etc/php-fpm.d/www.conf
1 2 3 4 5 6 7 8 9 10 11 |
#Line 8-10 user = nginx group = nginx #Line 22 listen = 127.0.0.1:9000 #Line 366-370 env[HOSTNAME] = $HOSTNAME env[PATH] = /usr/local/bin:/usr/bin:/bin env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp |
1 2 |
mkdir -p /var/lib/php/session chown nginx:nginx -R /var/lib/php/session/ |
nginx
> vim /etc/nginx/conf.d/nextcloud.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
upstream php-handler { server 127.0.0.1:9000; #server unix:/var/run/php5-fpm.sock; } server { listen 80; server_name pan.itnotebooks.com; # enforce https return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name pan.itnotebooks.com; ssl_certificate /etc/nginx/conf.d/ssl/itnotebooks.com/current/itnotebooks.crt; ssl_certificate_key /etc/nginx/conf.d/ssl/itnotebooks.com/current/itnotebooks.key; add_header X-Content-Type-Options nosniff; 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; location = /robots.txt { allow all; log_not_found off; access_log off; } 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 { } location ^~ / { root /storage/apps/html; # set max upload size client_max_body_size 512M; fastcgi_buffers 64 4K; # Enable gzip but do not remove ETag headers gzip on; gzip_vary on; gzip_comp_level 4; gzip_min_length 256; gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; location / { rewrite ^ /index.php$uri; } location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ { deny all; } location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { deny all; } location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.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; 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/ =404; index index.php; } location ~ \.(?:css|js|woff|svg|gif)$ { try_files $uri /index.php$uri$is_args$args; add_header Cache-Control "public, max-age=15778463"; add_header X-Content-Type-Options nosniff; 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 ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ { try_files $uri /index.php$uri$is_args$args; access_log off; } } } |
启动相关服务
1 2 3 4 5 |
systemctl start php-fpm systemctl start nginx systemctl enable php-fpm systemctl enable nginx |
数据库
1 2 3 4 |
create database nextcloud_db; create user nextclouduser@'%' identified by 'xxxxxxxxxx'; grant all privileges on nextcloud_db.* to nextclouduser@'%' identified by 'xxxxxxxxxx'; flush privileges; |
如果想赏钱,可以用微信扫描下面的二维码,一来能刺激我写博客的欲望,二来好维护云主机的费用; 另外再次标注博客原地址 itnotebooks.com 感谢!