上篇《Linux部署Nginx+Mysql+PHP+PHPMyAdmin4環境》中,咱們經過文章已經學會基本的LNMP環境的部署,本次開始部署一套私有云盤來來驗證環境,並提高對Linux認識與興趣。php
首先介紹一下這次任務主角NextCloud:html
NextCloud的前身叫Owncloud,Owncloud的老大被投資後不滿產品商業化氣息過重,Owncloud GmbH(德國)和 Owncloud Inc(美國)之間逐漸造成了沒法逾越的鴻溝。公司開始經過提供技術支持賺錢,並向其餘領域擴張,抱怨的聲音開始在開源社區久久迴盪。因而決定憤然離職從新開發了NextCloud。事實證實確實要比 OwnCloud 更體貼好用!
mysql
1、開始安裝-下載nginx
NextCloud官網:https://www.nextcloud.com
sql
網站上有各類平臺的部署包,有ovf、docker、tar等等,咱們採起TAR包的形式部署。docker
[root@VM-01 /]# cd /tmp [root@VM-01 tmp]# wget https://download.nextcloud.com/server/releases/nextcloud-13.0.2.tar.bz2 [root@VM-01 tmp]# tar -jxvf nextcloud-13.0.2.tar.bz2 [root@VM-01 tmp]# mv nextcloud /www [root@VM-01 tmp]# chown -R apache:apache /www/nextcloud [root@VM-01 tmp]# chmod 777 /www/nextcloud/config [root@VM-01 tmp]# mkdir /data [root@VM-01 tmp]# chown -R apache:apache /data
2、開始安裝-配置數據庫數據庫
修改默認字符集:uft8mb4apache
[root@VM-01 /]# vim /etc/my.cnf
添加utf8mb4配置如圖vim
[client] default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4 [mysqld] character-set-client-handshake = FALSE character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci init_connect='SET NAMES utf8mb4' innodb_large_prefix=ON innodb_file_format=Barracuda innodb_file_per_table=ON [root@VM-01 /]# service mysqld restart [root@VM-01 /]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.22 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show variables like "%character%";show variables like "%collation%"; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8mb4 | | character_set_connection | utf8mb4 | | character_set_database | utf8mb4 | | character_set_filesystem | binary | | character_set_results | utf8mb4 | | character_set_server | utf8mb4 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.01 sec) +----------------------+--------------------+ | Variable_name | Value | +----------------------+--------------------+ | collation_connection | utf8mb4_unicode_ci | | collation_database | utf8mb4_unicode_ci | | collation_server | utf8mb4_unicode_ci | +----------------------+--------------------+ 3 rows in set (0.02 sec) mysql> create database nextcloud; Query OK, 1 row affected (0.02 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | nextcloud | | performance_schema | | phpmyadmin | | sys | +--------------------+ 6 rows in set (0.00 sec)
坑一:SQLSTATE[HY000] [2019] Can't initialize character set utf8mb4 (path: /usr/share/mysql/charsets/)bash
[root@VM-01 /]# yum remove php56w-mysql [root@VM-01 /]# yum install php56w-mysqlnd
3、開始安裝-配置Nginx,開啓pathinfo。
[root@VM-01 /]# cd /etc/nginx/conf.d [root@VM-01 conf.d]# cp default.conf nextcloud.conf [root@VM-01 conf.d]# vim nextcloud.conf server { listen 8082; server_name localhost; client_max_body_size 1000m; #charset koi8-r; access_log /var/log/nginx/nextcloud.log main; location / { root /www/nextcloud; index index.html index.htm index.php; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ [^/]\.php(/|$) { root /www/nextcloud; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_split_path_info ^(.+?\.php)(/.*)$; set $path_info $fastcgi_path_info; fastcgi_param PATH_INFO $path_info; try_files $fastcgi_script_name =404; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } }
4、Web安裝-NextCloud
訪問:http://192.168.18.232:8082
當你看到最後的頁面說明已經安裝成功了,快享受技術帶來的愉悅感吧!:)
我在公網上也部署了這套系統,有興趣的同窗要是着急體驗對比能夠直接訪問:
NextCloud
http://111.231.86.247:8084
Name: Guest
Password: www.richcan
OwnCloud
http://111.231.86.247:8082
Name: Guest
Password: www.richcan
全文完!