nextcloud 安装部署

php版本不对

ubuntu nginx 配置php 网站-CSDN博客

抄自chatgpt ubuntu完全卸载干净某个包-CSDN博客

以及设置基本的php nginx环境参照上面两篇博文

然后参照官方文档 Example installation on Ubuntu 22.04 LTS — Nextcloud latest Administration Manual latest documentation

安装依赖

sudo apt update && sudo apt upgrade
sudo apt install apache2 mariadb-server libapache2-mod-php php-gd php-mysql \
php-curl php-mbstring php-intl php-gmp php-bcmath php-xml php-imagick php-zip

 安装数据库

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON nextcloud.* TO 'username'@'localhost';
FLUSH PRIVILEGES;//实际使用将username改为你的登录用户名 password改为你要设置的密码
CREATE USER 'admin'@'localhost' IDENTIFIED BY '123456';
CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON nextcloud.* TO 'admin'@'localhost';
FLUSH PRIVILEGES;

参照官方文档设置

Development environment — Nextcloud latest Developer Manual latest documentation

3. 将nextcloud源码下载到/var/www/nextcloud 下 将3rdpart单独下载到/var/www/nextcloud下

3.1)创建data文件夹这个用来存数据库文件的

3.2)配置data config 

sudo chmod o+rw /var/wwwcd 到/var/www/nextcloud 目录下
sudo chown -R www-data:www-data config data apps

4.配置nginx-fpm 修改 路径如下 /etc/php/8.3/fpm/pool.d 这里php的版本根据你在nginx.conf里配置的php-fpm版本来

到这里基本环境部署没有问题了

然后 把nextcloud 加载到nginx上

首先copy NGINX configuration — Nextcloud latest Administration Manual latest documentation

上关于nginx的配置

需要修改 这里好像只能支持https访问 用http不行 

1.生成证书

mkdir -p /etc/nginx/cert/
openssl req -new -x509 -days 365 -nodes -out /etc/nginx/cert/nextcloud.crt -keyout /etc/nginx/cert/nextcloud.key

最终的nginx配置文件如下

upstream php-handler {server 127.0.0.1:9000;#server unix:/run/php/php8.2-fpm.sock;
}# Set the `immutable` cache control options only for assets with a cache busting `v` argument
map $arg_v $asset_immutable {"" "";default ", immutable";
}server {listen 80;listen [::]:80;server_name cloud.example.com;# Prevent nginx HTTP Server Detectionserver_tokens off;# Enforce HTTPSreturn 301 https://$server_name$request_uri;
}server {listen 443      ssl http2;listen [::]:443 ssl http2;server_name cloud.example.com;# Path to the root of your installationroot /var/www/nextcloud-28.0.0; #修改点1# Use Mozilla's guidelines for SSL/TLS settings# https://mozilla.github.io/server-side-tls/ssl-config-generator/ssl_certificate     /etc/nginx/cert/nextcloud.crt; #修改点2ssl_certificate_key /etc/nginx/cert/nextcloud.key; #修改点3# Prevent nginx HTTP Server Detectionserver_tokens off;# HSTS settings# 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 Strict-Transport-Security "max-age=15768000; includeSubDomains; preload" always;# set max upload size and increase upload timeout:client_max_body_size 512M;client_body_timeout 300s;fastcgi_buffers 64 4K;# Enable gzip but do not remove ETag headersgzip 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 text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm 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;# Pagespeed is not supported by Nextcloud, so if your server is built# with the `ngx_pagespeed` module, uncomment this line to disable it.#pagespeed off;# The settings allows you to optimize the HTTP2 bandwidth.# See https://blog.cloudflare.com/delivering-http-2-upload-speed-improvements/# for tuning hintsclient_body_buffer_size 512k;# HTTP response headers borrowed from Nextcloud `.htaccess`add_header Referrer-Policy                   "no-referrer"       always;add_header X-Content-Type-Options            "nosniff"           always;add_header X-Frame-Options                   "SAMEORIGIN"        always;add_header X-Permitted-Cross-Domain-Policies "none"              always;add_header X-Robots-Tag                      "noindex, nofollow" always;add_header X-XSS-Protection                  "1; mode=block"     always;# Remove X-Powered-By, which is an information leakfastcgi_hide_header X-Powered-By;# Set .mjs and .wasm MIME types# Either include it in the default mime.types list# and include that list explicitly or add the file extension# only for Nextcloud like below:include mime.types;types {text/javascript js mjs;application/wasm wasm;}# Specify how to handle directories -- specifying `/index.php$request_uri`# here as the fallback means that Nginx always exhibits the desired behaviour# when a client requests a path that corresponds to a directory that exists# on the server. In particular, if that directory contains an index.php file,# that file is correctly served; if it doesn't, then the request is passed to# the front-end controller. This consistent behaviour means that we don't need# to specify custom rules for certain paths (e.g. images and other assets,# `/updater`, `/ocs-provider`), and thus# `try_files $uri $uri/ /index.php$request_uri`# always provides the desired behaviour.index index.php index.html /index.php$request_uri;# Rule borrowed from `.htaccess` to handle Microsoft DAV clientslocation = / {if ( $http_user_agent ~ ^DavClnt ) {return 302 /remote.php/webdav/$is_args$args;}}location = /robots.txt {allow all;log_not_found off;access_log off;}# Make a regex exception for `/.well-known` so that clients can still# access it despite the existence of the regex rule# `location ~ /(\.|autotest|...)` which would otherwise handle requests# for `/.well-known`.location ^~ /.well-known {# The rules in this block are an adaptation of the rules# in `.htaccess` that concern `/.well-known`.location = /.well-known/carddav { return 301 /remote.php/dav/; }location = /.well-known/caldav  { return 301 /remote.php/dav/; }location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }location /.well-known/pki-validation    { try_files $uri $uri/ =404; }# Let Nextcloud's API for `/.well-known` URIs handle all other# requests by passing them to the front-end controller.return 301 /index.php$request_uri;}# Rules borrowed from `.htaccess` to hide certain paths from clientslocation ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)  { return 404; }location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console)                { return 404; }# Ensure this block, which passes PHP files to the PHP process, is above the blocks# which handle static assets (as seen below). If this block is not declared first,# then Nginx will encounter an infinite rewriting loop when it prepends `/index.php`# to the URI, resulting in a HTTP 500 error response.location ~ \.php(?:$|/) {# Required for legacy supportrewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode(_arm64)?\/proxy) /index.php$request_uri;fastcgi_split_path_info ^(.+?\.php)(/.*)$;set $path_info $fastcgi_path_info;try_files $fastcgi_script_name =404;include fastcgi_params;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;fastcgi_param PATH_INFO $path_info;fastcgi_param HTTPS on;fastcgi_param modHeadersAvailable true;         # Avoid sending the security headers twicefastcgi_param front_controller_active true;     # Enable pretty urls#  fastcgi_pass php-handler;  #修改点4fastcgi_intercept_errors on;fastcgi_request_buffering off;fastcgi_pass unix:/run/php/php8.3-fpm.sock; #修改点5fastcgi_max_temp_file_size 0;}# Serve static fileslocation ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {try_files $uri /index.php$request_uri;# HTTP response headers borrowed from Nextcloud `.htaccess`add_header Cache-Control                     "public, max-age=15778463$asset_immutable";add_header Referrer-Policy                   "no-referrer"       always;add_header X-Content-Type-Options            "nosniff"           always;add_header X-Frame-Options                   "SAMEORIGIN"        always;add_header X-Permitted-Cross-Domain-Policies "none"              always;add_header X-Robots-Tag                      "noindex, nofollow" always;add_header X-XSS-Protection                  "1; mode=block"     always;access_log off;     # Optional: Don't log access to assets}location ~ \.woff2?$ {try_files $uri /index.php$request_uri;expires 7d;         # Cache-Control policy borrowed from `.htaccess`access_log off;     # Optional: Don't log access to assets}# Rule borrowed from `.htaccess`location /remote {return 301 /remote.php$request_uri;}location / {try_files $uri $uri/ /index.php$request_uri;}
}

这个文件名字叫php 放在/etc/nginx/sites-availbale 下

然后根据我这里环境/etc/nginx/nginx.conf的配置会读取 /etc/nginx/sites-enabled/*

注意这个目录下只能有一个配置文件多了会报nginx版本不唯一的错误

重启nginx

sudo systemctl reload nginx
然后用
sudo nginx -t 检验nginx.conf配置有没有错

到这里打开浏览器https://127.0.0.1:443  应该可以看到界面了

如果要配置域名访问 需要修改/var/www/nextcloud-28.0.0/config/config.php

在下面的array下加个1 修改后 如后面

最终的配置文件如下 

<?php
$CONFIG = array ('instanceid' => 'ocs16cx1zwae','passwordsalt' => 'ne5De7H2pGPJ6zVqN+8wdsc7aEVJ/H','secret' => 'mVKj7Imqr/npL0NDU5/A27U9ftpvJBBiXZD8LwqeerXJd973','trusted_domains' =>array (0 => '192.168.124.41',1 => '127.0.0.1',2 => 'localhost',3 => 'cloud.example.com',),'datadirectory' => '/var/www/nextcloud-28.0.0/data','dbtype' => 'mysql','version' => '29.0.0.19','overwrite.cli.url' => 'https://192.168.124.41','dbname' => 'nextcloud','dbhost' => 'localhost','dbport' => '','dbtableprefix' => 'oc_','mysql.utf8mb4' => true,'dbuser' => 'admin','dbpassword' => '123456','updater.release.channel' => 'git','installed' => true,
);

至此localhost 跟127.0.0.1可以访问了但是域名不行

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/840140.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

5月30日在线研讨会 | 面向智能网联汽车的产教融合解决方案

随着智能网联汽车技术的快速发展&#xff0c;产业对高素质技术技能人才的需求日益增长。为了促进智能网联汽车行业的健康发展&#xff0c;推动教育链、人才链与产业链、创新链的深度融合&#xff0c;经纬恒润推出产教融合相关方案&#xff0c;旨在通过促进教育链与产业链的深度…

第八节 条件装配案例讲解

一、条件装配的作用是什么 条件装配是 Spring 框架中一个强大的特性&#xff0c;使得开发者能够创建更加灵活和可维护的应用程序。在 Spring Boot 中&#xff0c;这个特性被大量用于自动配置&#xff0c;极大地简化了基于 Spring 的应用开发。 二、条件装配注解 <dependen…

Function Calling 介绍与实战

functions 是 Chat Completion API 中的可选参数&#xff0c;用于提供函数定义。其目的是使 GPT 模型能够生成符合所提供定义的函数参数。请注意&#xff0c;API不会实际执行任何函数调用。开发人员需要使用GPT 模型输出来执行函数调用。 如果提供了functions参数&#xff0c;…

AIGC:AI整活!万物皆可建筑设计

在过去的一年里 AI设计爆火 各行业纷纷将之用于工作中 同时不少网友也在借助它整活 万物皆可设计 甲方骂我方案像屎一样 于是我就回馈他屎一样的方案 他有点惊喜&#xff0c;但是没话 不是吧&#xff0c;随便找了个充电头图片 也能生成建筑设计&#xff01;这都能行 鸟…

【spring】@CrossOrigin注解学习

CrossOrigin介绍 CrossOrigin 是 Spring Framework 中的一个注解&#xff0c;用于处理跨域资源共享&#xff08;CORS&#xff09;问题。CORS 是一种机制&#xff0c;它使用额外的 HTTP 头来告诉浏览器&#xff0c;让运行在一个 origin (domain) 上的Web应用被准许访问来自不同…

虹科Pico汽车示波器 | 免拆诊断案例 | 2017款奔驰E300L车行驶中发动机偶尔无法加速

故障现象 一辆2017款奔驰E300L车&#xff0c;搭载274 920发动机&#xff0c;累计行驶里程约为21万km。车主反映&#xff0c;该车行驶中发动机偶尔无法加速&#xff0c;且车辆发闯。 故障诊断 用故障检测仪检测&#xff0c;发动机控制单元&#xff08;N3/10&#xff09;中存储…

Labelme自定义数据集COCO格式【实例分割】

参考博客 labelme标注自定义数据集COCO类型_labelme标注coco-CSDN博客 LabelMe使用_labelme中所有的create的作用解释-CSDN博客 1制作自己的数据集 1.1labelme安装 自己的数据和上面数据的区别就在于没有.json标签文件&#xff0c;所以训练自己的数据关键步骤就是获取标签文…

Web3探索加密世界:空投常见类型有哪些?附操作教程

每种空投类型都有独特的特征和目的&#xff0c;我们需要了解不同类型的加密空投。本文给大家介绍的是流行的加密货币空投类型&#xff0c;以及一般空投是如何做的。感兴趣的话请看下去。 一、空投常见类型 1、持有者空投 持有者空投向钱包中持有一定数量数字货币的人免费发放…

2024.05.24 学习记录

1、面经复习&#xff1a; js基础、知识深度、js垃圾回收 2、代码随想录刷题&#xff1a;动态规划 完全背包 all 3、rosebush 完成 Tabs、Icon、Transition组件

基于YOLO系列算法(YOLOv5、YOLOv6、YOLOv8以及YOLOv9)和Streamlit框架的行人头盔检测系统

摘要 本文基于最新的基于深度学习的目标检测算法 (YOLOv5、YOLOv6、YOLOv8)以及YOLOv9) 对头盔数据集进行训练与验证&#xff0c;得到了最好的模型权重文件。使用Streamlit框架来搭建交互式Web应用界面&#xff0c;可以在网页端实现模型对图像、视频和实时摄像头的目标检测功能…

C++中获取int最大与最小值

不知道大家有没有遇到过这种要求&#xff1a;“返回值必须是int&#xff0c;如果整数数超过 32 位有符号整数范围 [−2^31, 2^31 − 1] &#xff0c;需要截断这个整数&#xff0c;使其保持在这个范围内。例如&#xff0c;小于 −2^31 的整数应该被固定为 −2^31 &#xff0c;大…

保护元件-详实的熔断器(保险丝)知识

目录&#xff1a; 一、汽车保险丝设计与选型 1、概述 2、构造及工作原理 1&#xff09;构造 2&#xff09;工作原理 3&#xff09;保险丝熔断及分断时间 4&#xff09;时间/电流特性曲线 5&#xff09;环境温度修正系数 3、熔化热能值I2t★ 4、三种电流模型 1&a…

java技术:spring-secrity实现认证、授权

目录 一、依赖 二、逻辑图 三、代码设计 1、WebSecurityConfigurerAdapter的实现类 2、设计登录接口 config配置&#xff1a; 1&#xff09;UserDetailsService实现类重写&#xff1a; 2&#xff09;书写登录实现类&#xff08;调用authenticationManager、可以与后面的…

Vue学习笔记2——创建一个Vue项目

Vue项目 1、创建一个Vue项目2、Vue项目的目录结构3、模版语法4、属性绑定5、条件渲染 1、创建一个Vue项目 vue官方文档&#xff1a; https://cn.vuejs.org/打开命令行界面&#xff08; “winR"再输入"cmd”&#xff09;&#xff0c;切换位置到指定的位置创建vue项目…

微星打造全球首款DDR5 CAMM2内存主板:这下清爽了

微星预告了新款主板“ Z790 Project Zero Plus”&#xff0c;这也是 全球第一款配备DDR5 CAMM2内存的桌面主板&#xff01; CAMM全称为“Compression Attached Memory Module”&#xff0c;已被JEDEC组织接纳为行业标准&#xff0c;相比传统的SO-DIMM、DIMM内存最大特点就是取消…

MM模块五(采购订单)

创建采购订单&#xff1a;ME21N 参考报价单创建采购订单&#xff1a; 哪个采购部门的哪个采购员为哪个公司代码下的采购订单 点击保存 注&#xff1a;采购订单的数量不能大于采购申请的数量

Milvus 高级特性

引言 Milvus 的高级特性包括分布式架构、安全性和监控与日志管理&#xff0c;这些特性使得 Milvus 能够更好地适应企业级应用的需求。 一、分布式架构 1.1 集群部署 在当今大数据和人工智能的时代&#xff0c;向量数据库以其对高维数据的强大处理能力&#xff0c;成为了许多…

Map遍历、反射、GC

map的遍历 用foreach遍历 HashMap<Character,Integer> map new HashMap<>();map.put(A,2);map.put(B,3);map.put(C,3);for (Map.Entry<Character,Integer> entry: map.entrySet()) {char key entry.getKey();int value entry.getValue();System.out.prin…

影视解说5.0版零基础视频课程

课程简介 现在还能做解说吗、不会写解说文案怎么解决、不会配音怎么解决、如何找到合适的素材资源、如何变现…这是很多想做解说的伙伴最关心的几大问题。比如文案&#xff0c;我们推荐一个网站&#xff0c;10分钟搞定一篇文案&#xff0c;配音可以真人配音也可以软件配音。5.…

【区块链】fisco网络运维之添加节点黑名单

基于已完成的区块链系统与管理平台搭建工作&#xff0c;开展区块链节点的黑名单工作&#xff0c;具体操作如下 以node3为例子 1查看node0节点的连接状态日志&#xff08;现有4个节点连接&#xff09; 注意&#xff1a;如果查询不到连接状态&#xff0c;修改node0的配置文件中…