NextCloud+MySQL+PHP+Nginx+Raspberry Pi OS

1、PHP安装

sudo apt-get install php7.4-*

2、下载NextCloud,并解压

下载nextcloud,解压。

创建data文件夹,并设置 777

设置 nextcloud 用户组合用户为 www-data

cd /home
wget https://download.nextcloud.com/server/releases/nextcloud-24.0.1.tar.bz2
tar xvf nextcloud-24.0.1.tar.bz2
cd /home
mkdir data
chown 777 data
cd ..
chmod -R www-data:www-data /home/nextcloud

3、Nginx配置

按照下面文章配置,把下面的配置项放到nextcloud文件下面

Nginx配置多个网站

# nextcloud Nginx配置
server {
	listen 80 default_server;
	listen [::]:80 default_server;

	# SSL configuration
	#
	# listen 443 ssl default_server;
	# listen [::]:443 ssl default_server;
	#
	# Note: You should disable gzip for SSL traffic.
	# See: https://bugs.debian.org/773332
	#
	# Read up on ssl_ciphers to ensure a secure configuration.
	# See: https://bugs.debian.org/765782
	#
	# Self signed certs generated by the ssl-cert package
	# Don't use them in a production server!
	#
	# include snippets/snakeoil.conf;

	root /home/nextcloud;

	# Add index.php to the list if you are using PHP
	index  *.php;

	server_name _;

	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		try_files $uri $uri/ =404;
	}

	# pass PHP scripts to FastCGI server
	#
	location ~ .php$ {
		include snippets/fastcgi-php.conf;
	#
	#	# With php-fpm (or other unix sockets):
	#	fastcgi_pass unix:/run/php/php7.4-fpm.sock;
	#	# With php-cgi (or other tcp sockets):
	#	fastcgi_pass 127.0.0.1:9000;
	fastcgi_split_path_info ^(.+.php)(.*)$;
	fastcgi_param PATH_INFO $fastcgi_path_info;
	fastcgi_pass unix:/run/php/php7.4-fpm.sock;
			}

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#
	#location ~ /.ht {
	#	deny all;
	#}
}

4、MySQL

sudo apt-get install mysql*

登录MySQL

sudo mysql -u root -p

修改root密码

注释掉sudo vim /etc/msyql/mariadb.conf.d/50-server.cnf 配置文件的bind-address =127.0.0.1

重启MySQL

sudo service mysql restart

MySQL工具登录,创建nextcloud数据库

5、浏览器输入nextcloud服务器IP

Nginx 配置



知识共享许可协议本作品采用知识共享署名-相同方式共享 4.0 国际许可协议进行许可。

相关推荐

Nginx代理apache2折腾笔记

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

暂无评论

目录展开