Ubuntu搭建Nginx-Nextcloud环境

1、环境部署与安装

安装mysql-server

sudo apt-get install mysql-server

创建数据库名

create database nextcloud

查看数据名称

show databases

安装PHP7.4

sudo apt-get install php7.4-*

安装Nginx

sudo apt-get install nginx

下载最新nextcloud版本

最新版本可以登录https://download.nextcloud.com/server/releases/网址下载

 wget https://download.nextcloud.com/server/releases/nextcloud-24.0.1.tar.bz2

复制nextcloud文件夹,我复制到的是/var/www/文件夹下面

 cp -r nextcloud /var/www/

进入nextcloud文件夹下面,创建data文件夹,作用是用来存储上传的文件的.

sudo mkdir data

配置文件夹权限

chmod -R 777 nextcloud/
sudo chown -R www-data:www-data nextcloud

2、Nextcloud Nginx相关配置

首先打开配置文件

vim /etc/nginx/nginx.conf

在http{}里面添加下面配置

# set client body size to 2M #

client_max_body_size 512M;

重启nginx

sudo systemctl restart nginx

3、Nginx配置PHP,nextcloud

vim /etc/nginx/nginx.conf

Nginx配置PHP

#PHP 服务器

server {

listen 80;

listen [::]:80;

server_name nextcloud.saiita.cn;

root /var/www/nextcloud;

index index.html index.php *.php;

location / {

try_files $uri $uri/ =404;

}

location ~ \.php {

include snippets/fastcgi-php.conf;

#

# # With php7.0-cgi alone:

# fastcgi_pass 127.0.0.1:9000;

# # With php7.0-fpm:

fastcgi_split_path_info ^(.+\.php)(.*)$;

fastcgi_param PATH_INFO $fastcgi_path_info;

fastcgi_pass unix:/run/php/php7.0-fpm.sock;

}

# deny access to .htaccess files, if Apache’s document root

# concurs with nginx’s one

#

location ~ /\.ht {

deny all;

}

}
点赞 0

Saiyintai

软件测试工程师

相关推荐

Nginx代理apache2折腾笔记

apache2上面有php服务器已经配置好的。只是想用Nginx代理apache2. Nginx上有Tomat服务器,代理后就相当于有PHP服务器,JSP …