Bootstrap

搭建私有云存储

1、安装LNMP环境

yum install nginx -y
yum install -y nginx mariadb-server php  php-fpm php-mysqlnd
systemctl restart nginx.service ---	启动Nginx
systemctl start mariadb.service ---启动数据库
mysql -e 'create database lxdb character set utf8' ---创建数据库
mysql -e "create user lc@localhost identified by '123456'" ---创建新用户
mysql -e "grant all on lxdb.* to lc@localhost" ---将lxdb数据库的所有权限赋予用户lc

2、测试php和nginx是否可以协同工作

vim /usr/share/nginx/html/phpinfo.php
<?php
phpinfo();
?>
vim /usr/share/nginx/html/mysql.php
<?php
$servername="localhost";
$username="lc";
$password="123456";
$dbname ="lxdb";//创建连接
$conn =new mysqli($servername ,$username, $password,$dbname);//检测连接
if  ($conn->connect_error){
        die("连接失败:" .$conn->connect_error);
                        }
echo "连接成功";//关闭连接
mysqli_close($conn)
?>  

文件内容写完后可以通过 php -l mysql.php 命令测试语法是否正确,提示No syntax errors detected in phpinfo.php表示语法没有问题

完成之后打开浏览器输入本机IP/phpinfo.php ;本机IP/mysql.php,我的IP为192.168.50.253,输入192.168.50.253/phpinfo.php后显示如下

输入192.168.50.253/mysql.php后显示如下

测试没问题的话建议删除.php文件(存在安全隐患)

rm -rf /usr/share/nginx/html/*.php

3、下载nextcloud-25.0.1.tar.bz2并上传到本机

解压软件

yum install tar -y --- 默认没有下载tar,需要先下载
tar xf nextcloud-25.0.1.tar.bz2 -C /usr/local/ ---将文件解压到/usr/local/下
/etc/php-fpm.d/www.conf文件中已指定用户 
因为所属者和所属组为apache,赋予777权限太大,只需要改所属者和所属组为apache即可
chown -R apache.apache /usr/local/nextcloud/

4、编辑子配置文件

vim /etc/nginx/conf.d/webphp.conf
server{
        server_name www.nextcloud.edu;
        root /usr/local/nextcloud;

        include /etc/nginx/default.d/*.conf;
}

5、在Windows C:\Windows\System32\drivers\etc\hosts文件中添加一条

6、进入浏览器输入网址即可

提示未安装模组,根据提示安装即可

yum install php-gd php-xml php-pecl-zip php-mbstring -y
Last metadata expiration check: 0:11:28 ago on Thu 28 Nov 2024 11:35:04 PM CST.
Dependencies resolved.
==================================================================================================================================
 Package                           Architecture            Version                              Repository                   Size
==================================================================================================================================
Installing:
 php-gd                            x86_64                  8.0.30-6.oe2203sp4                   update                       31 k
 php-mbstring                      x86_64                  8.0.30-6.oe2203sp4                   update                      422 k
 php-pecl-zip                      x86_64                  1.19.3-1.oe2203sp4                   EPOL                         45 k
 php-xml                           x86_64                  8.0.30-6.oe2203sp4                   update                      109 k
Installing dependencies:
 cmake-filesystem                  x86_64                  3.22.0-9.oe2203sp4                   OS                          7.1 k
 libzip                            x86_64                  1.8.0-4.oe2203sp4                    everything                   78 k
 oniguruma                         x86_64                  6.9.6-1.oe2203sp4                    everything                  156 k

Transaction Summary
==================================================================================================================================
Install  7 Packages

Total download size: 849 k
Installed size: 2.4 M
Downloading Packages:
(1/7): libzip-1.8.0-4.oe2203sp4.x86_64.rpm                                                        157 kB/s |  78 kB     00:00    
(2/7): cmake-filesystem-3.22.0-9.oe2203sp4.x86_64.rpm                                              13 kB/s | 7.1 kB     00:00    
(3/7): oniguruma-6.9.6-1.oe2203sp4.x86_64.rpm                                                     271 kB/s | 156 kB     00:00    
(4/7): php-pecl-zip-1.19.3-1.oe2203sp4.x86_64.rpm                                                 211 kB/s |  45 kB     00:00    
(5/7): php-gd-8.0.30-6.oe2203sp4.x86_64.rpm                                                       118 kB/s |  31 kB     00:00    
(6/7): php-xml-8.0.30-6.oe2203sp4.x86_64.rpm                                                      803 kB/s | 109 kB     00:00    
(7/7): php-mbstring-8.0.30-6.oe2203sp4.x86_64.rpm                                                 1.4 MB/s | 422 kB     00:00    
----------------------------------------------------------------------------------------------------------------------------------
Total                                                                                             979 kB/s | 849 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                          1/1 
  Installing       : oniguruma-6.9.6-1.oe2203sp4.x86_64                                                                       1/7 
  Installing       : cmake-filesystem-3.22.0-9.oe2203sp4.x86_64                                                               2/7 
  Installing       : libzip-1.8.0-4.oe2203sp4.x86_64                                                                          3/7 
  Running scriptlet: libzip-1.8.0-4.oe2203sp4.x86_64                                                                          3/7 
  Installing       : php-pecl-zip-1.19.3-1.oe2203sp4.x86_64                                                                   4/7 
  Installing       : php-mbstring-8.0.30-6.oe2203sp4.x86_64                                                                   5/7 
  Installing       : php-xml-8.0.30-6.oe2203sp4.x86_64                                                                        6/7 
  Installing       : php-gd-8.0.30-6.oe2203sp4.x86_64                                                                         7/7 
  Running scriptlet: php-gd-8.0.30-6.oe2203sp4.x86_64                                                                         7/7 
  Verifying        : cmake-filesystem-3.22.0-9.oe2203sp4.x86_64                                                               1/7 
  Verifying        : libzip-1.8.0-4.oe2203sp4.x86_64                                                                          2/7 
  Verifying        : oniguruma-6.9.6-1.oe2203sp4.x86_64                                                                       3/7 
  Verifying        : php-pecl-zip-1.19.3-1.oe2203sp4.x86_64                                                                   4/7 
  Verifying        : php-gd-8.0.30-6.oe2203sp4.x86_64                                                                         5/7 
  Verifying        : php-mbstring-8.0.30-6.oe2203sp4.x86_64                                                                   6/7 
  Verifying        : php-xml-8.0.30-6.oe2203sp4.x86_64                                                                        7/7 

Installed:
  cmake-filesystem-3.22.0-9.oe2203sp4.x86_64   libzip-1.8.0-4.oe2203sp4.x86_64          oniguruma-6.9.6-1.oe2203sp4.x86_64      
  php-gd-8.0.30-6.oe2203sp4.x86_64             php-mbstring-8.0.30-6.oe2203sp4.x86_64   php-pecl-zip-1.19.3-1.oe2203sp4.x86_64  
  php-xml-8.0.30-6.oe2203sp4.x86_64           

Complete!

安装完成之后刷新页面

创建一个管理员账户点击安装

部署成功!!!

部署wordpress

1、数据库准备

mysql -e 'create database wordpress character set utf8'
mysql -e "create user wordpress@localhost identified by '123456'"
mysql -e "grant all on wordpress.* to wordpress@localhost"

 2、下载应用

tar -xf wordpress-6.4.1-zh_CN.tar.gz -C /usr/local/

3、修改所属组和所属者

chown -R apache.apache /usr/local/wordpress/

4、修改配置文件

vim /etc/nginx/conf.d/web.conf
server{
        server_name www.wordpress.edu;
        root /usr/local/wordpress;

        include /etc/nginx/default.d/*.conf;
}

5、重启nginx php-fpm,配置hosts

进入浏览器输入网址即可

 

 

文章发布成功!!!  

;