安装nextcloud
安装apache
yum -y install httpd
启动apache
systemctl start httpd.service
注:这里会占用80端口,如果想要不使用80端口则在 /etc/httdp/conf/httpd.conf中将Listen 80 修改为你想要的关口
直接访问IP+端口
PHP安装(添加EPEL和REMI存储库)
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install yum-utils
yum-config-manager --enable remi-php74
yum update
yum install php php-cli
yum install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json
测试
php -v
MySQL安装
可以参考Centos7安装mysql8.0教程
下载nextcloud
wget https://download.nextcloud.com/server/releases/nextcloud-18.0.2.zip
解压文件
unzip -q nextcloud-18.0.2.zip -d /var/www/html/
更改权限
chown -R apache:apache /var/www/html/nextcloud/
chmod 770 /var/www/html/nextcloud/ -Rf
重启服务
systemctl restart httpd
访问nextcloud页面
IP+端口/nextcloud/index.php
至此完成私有网盘的搭建
安装nginx后反向代理到私有next cloud
在nginx中这样配置
注:楼主这里是配置了SSL证书的
server {
#SSL 访问端口号为 443
listen 443 ssl;
ssl on;
#填写绑定证书的域名
server_name xxx.com;
#证书文件名称
ssl_certificate 你的.crt文件;
#私钥文件名称
ssl_certificate_key 你的.key文件;
ssl_session_timeout 5m;
#请按照以下协议配置
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
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;
add_header Strict-Transport-Security "max-age=15768000";
location / {
#网站主页路径。此路径仅供参考,具体请您按照实际目录操作。
#例如,您的网站运行目录在/etc/www下,则填写/etc/www。
root html;
index index.html index.htm;
}
location /nextcloud {
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass 你的next cloud访问地址;
}
}
配置好nginx后,在nextcloud的配置文件中添加 ‘overwriteprotocol’ => ‘https’ 这个配置