nextcloud+nginx+mysql,Ubuntu搭建Nginx-Nextcloud环境
環(huán)境部署與安裝
安裝mysql-server
“`
$ sudo apt-get install mysql-server
“`
安裝的過程中會設置密碼
進入mysql
“`
$ mysql -u root -p
“`
創(chuàng)建數(shù)據(jù)庫名
“`
$ reate database nextcloud
“`
查看數(shù)據(jù)名稱
“`
$ show databases
“`
安裝PHP7.0
“`
$ sudo apt-get install php7.0-*
“`
關(guān)于PHP7.0相關(guān)模塊都安裝了吧,這樣省心.
安裝Nginx
“`
$ sudo apt-get install nginx
“`
下載nextcloud 版本是11.0.3.有新版本可以到官網(wǎng)上復制下載鏈接
“`
$ wget https://download.nextcloud.com/server/releases/nextcloud-11.0.3.tar.bz2
“`
解壓
“`
$ tar xvf /nextcloud-11.0.3.tar.bz2
“`
復制nextcloud文件夾,我復制到的是/var/www/文件夾下面
“`
$ cp -r nextcloud /var/www/
“`
進入nextcloud文件夾下面,創(chuàng)建data文件夾,作用是用來存儲上傳的文件的.
“`
$ sudo mkdir data
“`
配置文件夾權(quán)限
“`
$ chmod -R 777 nextcloud/
$ sudo chown -R www-data:www-data nextcloud
“`
不配置文件權(quán)限的話,網(wǎng)頁打開會報404或者是403錯誤
Nextcloud Nginx相關(guān)配置
首先打開配置文件
“`
vim /etc/nginx/nginx.conf
“`
在http{}里面添加下面配置
“`
# set client body size to 2M #
client_max_body_size 512M;
“`
重啟nginx
“`
sudo systemctl restart nginx
“`
上面的配置是防止文件上傳,nextcloud報413錯誤
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;
}
}
“`
更多教程可以訪問:www.saiita.cn
總結(jié)
以上是生活随笔為你收集整理的nextcloud+nginx+mysql,Ubuntu搭建Nginx-Nextcloud环境的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 五粮液1618多少钱啊?
- 下一篇: “鸣鹤时一闻”下一句是什么