搭建Nextcloud

本文涉及的产品
RDS MySQL DuckDB 分析主实例,基础系列 4核8GB
RDS MySQL DuckDB 分析主实例,集群系列 4核8GB
RDS AI 助手,专业版
简介: 安装 私有云盘,mysql nginx redis php等组件
                     Nextcloud搭建

第一步 install start download
cd /usr/loacal/src
wget https://download.nextcloud.com/server/releases/nextcloud-13.0.2.tar.bz2
tar -jxf nextcloud-13.0.2.tar.bz2
mkdir -p /data/www
mv nextcloud /data/www
chown -R nginx. /data/www/nextcloud
useradd -s /sbin/nologin/ nginx -M
第二步骤 安装nginx
安装依赖
yum install gcc--c++ pcre pcre-devel zlib zlib-devel op
enssl openssl-devel -y
编译
./configure --prefix=/usr/local/nginx --pid-path
=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --error-log-path=/va
r/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzi
p_static_module --http-client-body-temp-path=/var/temp/nginx/client --http-prox
y-temp-path=/var/temp/nginx/proxy --http-fastcgi-temp-path=/var/temp/nginx/fast
cgi --http-uwsgi-temp-path=/var/temp/nginx/uwsgi --http-scgi-temp-path=/var/tem
--with-http_ssl_module
创建nginx temp目录
mkdir -p /var/temp/nginx
make install

启动 nginx
/usr/local/nginx/sbin/nginx
第三步install mariadb
yum install mariadb mariadb-server -y
vim /etc/my.cnf
[client]
default-character-set=utf8mb64
[mysql]
default-character-set=utf8mb64
[mysqld]
character-set-server=utf8mb64
collection-server=utf8mb64_unicode_cli
innodb_large_prefix=ON
innodb_file_format=Barracuda
innodb_file_per_table=ON
innodb_file_per_table=1
default-storage-engine = INNODB
初始化设置
/usr/bin/mysql_install_db --user=mysql --datadir=/var/lib/mysql
开启mysql服务
systemctl restart mariadb
创建数据库
create database nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
授权操作
grant all privileges on nextcloud.* to "nextcloud"@"%" identified by "nextcloud";
grant all privileges on nextcloud.* to "nextcloud"@"localhost" identified by "nextcloud";
刷新权限
flush privileges;
第四步安装php相关
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
subscription-manager repos --enable=rhel-6-server-optional-rpms
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php70w-fpm php70w-cli php70w-opcache php70w-gd php70w-mcrypt php70w-mysql php70w-pear php70w-xml php70w-mbstring php70w-pdo php70w-json php70w-pecl-apcu php70w-pecl-apcu-devel
验证php7的版本
php -v
配置php-fpm
sed -i "/^user =/s/apache/nginx/g" /etc/php-fpm.d/www.conf

sed -i '/^ugroup =/s/apache/nginx/g' /etc/php-fpm.d/www.conf

更改授权用户

mkdir -p /var/lib/php/session
chown nginx:nginx -R /var/lib/php/session/
最后 nginx的配置

vim vhost/*.conf
upstream php-handler {

    server 127.0.0.1:9000;
    }
server {
    listen       80;
    server_name  localhost;
    add_header Referrer-Policy "no-referrer" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Permitted-Cross-Domain-Policies "none" always;
    add_header X-Robots-Tag "none" always;
    add_header X-XSS-Protection "1; mode=block" always;
    # Remove X-Powered-By, which is an information leak
    fastcgi_hide_header X-Powered-By;
    root /data/www/nextcloud;

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location = /.well-known/carddav {
      return 301 $scheme://$host:$server_port/remote.php/dav;
    }
    location = /.well-known/caldav {
      return 301 $scheme://$host:$server_port/remote.php/dav;
    }




    location / {
         rewrite ^ /index.php;
    }

    location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
        deny all;
    }
    location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
        deny all;
    }                                                                                                                      
                                                                                                                           
    error_page   500 502 503 504  /50x.html;                                                                               
    location = /50x.html {                                                                                                 
        root   html;                                                                                                       
    }                                                                                                                      
                                                                                                                           
                                                                                                                           
        root /data/www/nextcloud;                                                                                          
        fastcgi_pass 127.0.0.1:9000;                                                                                       
        fastcgi_index index.php;                                                                                           
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;                                                  
        fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;                                                                       
        fastcgi_param PATH_INFO $fastcgi_path_info;                                                                        
        include fastcgi_params;                                                                                            
    }                                                                                                                      
                                                                                                                           
#    location ~ \.php$ {                                                                                                   
#        if (!-e $request_filename) {                                                                                      
#               rewrite ^/(.*)$ /index.php/$1 last;                                                                        
#        }                                                                                                                 
#        root           /usr/local/nginx/html/nextcloud;                                                                   
#        fastcgi_pass   127.0.0.1:9000;                                                                                    
#        fastcgi_index  index.php;                                                                                         
#        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;                                               
#        include        fastcgi_params;                                                                                    
#    }                                                                                                                     
     location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {                                                                   
          try_files $uri/ =404;                                                                                            
          index index.php;                                                                                                 
        add_header Cache-Control "public, max-age=15778463";                                                               
        # Add headers to serve security related headers (It is intended to                                                 
        # have those duplicated to the ones above)                                                                         
        # Before enabling Strict-Transport-Security headers please read into                                               
        # this topic first.                                                                                                
        #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;                      
        #                                                                                                                  
        # WARNING: Only add the preload option once you read about                                                         
        # the consequences in https://hstspreload.org/. This option                                                        
        # will add the domain to a hardcoded list that is shipped                                                          
        # in all major browsers and getting removed from this list                                                         
        # could take several months.                                                                                       
        add_header Referrer-Policy "no-referrer" always;                                                                   
        add_header X-Content-Type-Options "nosniff" always;                                                                
        add_header X-Download-Options "noopen" always;
        add_header X-Frame-Options "SAMEORIGIN" always;                                                                    
        add_header X-Permitted-Cross-Domain-Policies "none" always;                                                        
        add_header X-Robots-Tag "none" always;                                                                             
        add_header X-XSS-Protection "1; mode=block" always;                                                                
                                                                                                                           
        # Optional: Don't log access to assets                                                                             
        access_log off;                                                                                                    
     }                                                                                                                     
    location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ {                                                           
        try_files $uri /index.php$request_uri;                                                                             
        # Optional: Don't log access to other assets                                                                       
        access_log off;                                                                                                    
    }                                                                                                                      
                                                                                                                           
    # 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 applicat
ion/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;
}
Systemctl restart mariadb
Systemctl start php-fpm
/usr/local/nginx/sbin/nginx -s reload

相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。   相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情: https://www.aliyun.com/product/rds/mysql 
目录
相关文章
|
存储 Shell Linux
【Shell 命令集合 网络通讯 】Linux 显示Unix-to-Unix Copy (UUCP) 系统的状态信息 uustat命令 使用指南
【Shell 命令集合 网络通讯 】Linux 显示Unix-to-Unix Copy (UUCP) 系统的状态信息 uustat命令 使用指南
203 0
|
弹性计算 架构师 Cloud Native
阿里云新版ACE考试通关经历回顾
阿里云新版ACE考试通关经历回顾
|
安全 关系型数据库 MySQL
PowerDesigner逆向工程导入MYSQL数据库总结
PowerDesigner逆向工程导入MYSQL数据库总结
449 1
PowerDesigner逆向工程导入MYSQL数据库总结
|
4天前
|
人工智能 自然语言处理 JavaScript
2026年Windows+Ollama本地部署OpenClaw保姆级教程:本地AI Agent+阿里云上快速搭建
2026年OpenClaw凭借本地部署、私有化运行的特性,成为打造个人智能体的核心工具,而Ollama作为轻量级本地大模型管理工具,能让OpenClaw摆脱对云端大模型的依赖,实现**本地推理、数据不泄露、全流程私有化**的智能体验。本文基于Windows 11系统,从硬件环境准备、Ollama安装与模型定制、OpenClaw部署配置、技能扩展到常见问题排查,打造保姆级本地部署教程,同时补充阿里云OpenClaw(Clawdbot)快速部署步骤,兼顾本地私有化需求与云端7×24小时运行需求,文中所有代码命令均可直接复制执行,确保零基础用户也能快速搭建属于自己的本地智能体。
6357 40
|
2天前
|
人工智能 安全
CoPaw:3分钟部署你的 AI助理
源自阿里巴巴开源生态的个人 AI 助理——CoPaw。作为阿里倾力打造的开源力作,CoPaw 完美打通钉钉、飞书、Discord 等多平台对话通道,支持定时任务自动化。内置 PDF/Office 深度处理、新闻摘要等强大技能,更开放自定义扩展接口。坚持数据全程私有化部署,绝不上传云端,让每一位用户都能在大厂技术加持下,拥有安全、专属的智能助手。
|
5天前
|
人工智能 JSON JavaScript
手把手教你用 OpenClaw + 飞书,打造专属 AI 机器人
手把手教你用 OpenClaw(v2026.2.22-2)+ 飞书,10分钟零代码搭建专属AI机器人!内置飞书插件,无需额外安装;支持Claude等主流模型,命令行一键配置。告别复杂开发,像聊同事一样自然对话。
2890 8
手把手教你用 OpenClaw + 飞书,打造专属 AI 机器人
|
3天前
|
人工智能 自然语言处理 机器人
保姆级教程:Mac本地搭建OpenClaw及阿里云上1分钟部署OpenClaw+飞书集成实战指南
OpenClaw(曾用名Clawdbot、Moltbot)作为2026年最热门的开源个人AI助手平台,以“自然语言驱动自动化”为核心,支持对接飞书、Telegram等主流通讯工具,可替代人工完成文件操作、日历管理、邮件处理等重复性工作。其模块化架构适配多系统环境,既可以在Mac上本地化部署打造私人助手,也能通过阿里云实现7×24小时稳定运行,完美兼顾隐私性与便捷性。
2176 4
|
11天前
|
存储 人工智能 负载均衡
阿里云OpenClaw多Agent实战宝典:从极速部署到AI团队搭建,一个人=一支高效军团
在AI自动化时代,单一Agent的“全能模式”早已无法满足复杂任务需求——记忆臃肿导致响应迟缓、上下文污染引发逻辑冲突、无关信息加载造成Token浪费,这些痛点让OpenClaw的潜力大打折扣。而多Agent架构的出现,彻底改变了这一现状:通过“单Gateway+多分身”模式,让一个Bot在不同场景下切换独立“大脑”,如同组建一支分工明确的AI团队,实现创意、写作、编码、数据分析等任务的高效协同。
4953 31

热门文章

最新文章