LNMP搭建kodcloud个人私有网盘

本次实验基于Linux+Nginx+MySQL+Php搭建,除此以外需要搭建DNS服务器以及Redis服务器,除此以外服务器系统版本为rocky8.5版本。

拓扑图:

1.配置DNS-Server

#注意我设置的域名为www.jason.org

[root@dns-server ~]#yum -y install bind bind-utis
[root@dns-server ~]#vim /etc/named.conf
options {
        listen-on port 53 { localhost; }; #修改此内容
             allow-query     { any; };    #修改此内容
[root@dns-server ~]#vim /etc/named.rfc1912.zones     #添加以下内容
zone "jason.org" IN {
    type master;
    file  "jason.org.zone";
};
[root@dns-server ~]#vim /var/named/jason.org.zone   #添加以下内容

$TTL 1D
@       IN SOA  master admin (
                                        1       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
                NS       master
master      A    10.0.0.7
www             A    10.0.0.8
[root@dns-server ~]#systemctl enable --now named  #启动DNS服务
[root@dns-server ~]#ss -ntl   #出现53端口就ok
State       Recv-Q Send-Q  Local Address:Port                 Peer Address:Port
LISTEN      0      10           10.0.0.7:53                              *:*
LISTEN      0      10          127.0.0.1:53                              *:*
LISTEN      0      128                 *:22                              *:*
LISTEN      0      128         127.0.0.1:953                             *:*
LISTEN      0      100         127.0.0.1:25                              *:*
LISTEN      0      128                 *:111                             *:*
LISTEN      0      10              [::1]:53                           [::]:*
LISTEN      0      128              [::]:22                           [::]:*
LISTEN      0      128             [::1]:953                          [::]:*
LISTEN      0      100             [::1]:25                           [::]:*
LISTEN      0      128              [::]:111                          [::]:*

2.配置LNP

#nginx可以yum安装或者编译安装,编译安装可以参考我之前写的关于nginx编译安装的教程

[root@LNP-Server ~]#yum -y install php php-mysqlnd php-json php-xml php-gd php-mbstring
[root@LNP-Server ~]#vim /apps/nginx/conf/nginx.conf
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
include /apps/nginx/conf/conf.d/*.conf; #在最后一行添加以西内容
}
[root@LNP-Server ~]#mkdir /apps/nginx/conf/conf.d
[root@LNP-Server ~]#ln -s /apps/nginx/sbin/nginx /usr/bin/
[root@LNP-Server ~]#cd /apps/nginx/conf/conf.d/
[root@LNP-Server conf.d]#vim pc.conf
[root@LNP-Server conf.d]#vim pc.conf

server {
    server_name www.jason.org;
    root /apps/nginx/html/;
    index index.html;
    }
[root@LNP-Server ~]#cd /apps/nginx/html
[root@LNP-Server html]#vim index.html

<p> this is my websit </p>
[root@LNP-Server html]#nginx -t
nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
[root@LNP-Server html]#nginx -s reload
[root@LNP-Server html]#mkdir -p /data/php
[root@LNP-Server ~]#vim /apps/nginx/conf/conf.d/pc.conf

server {
  listen 80;
  server_name www.jason.org;
  root /data/php/;
  client_max_body_size 200M;
  location / {
      index index.php index.html;
  }
  location ~ \.php$ {
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
      include       fastcgi_params;
  }
 location ~ ^/(ping|pm_status)$ {
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
  include fastcgi_params;
}
}


[root@LNP-Server conf.d]#nginx -t
nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
[root@LNP-Server conf.d]#nginx -s reload

3.配置MySQL

[root@MySQL-Server ~]#yum -y install mysql-server
[root@MySQL-Server ~]#systemctl enable --now mysql-server
[root@MySQL-Server ~]#ss -ntl
State    Recv-Q    Send-Q       Local Address:Port        Peer Address:Port   Process
LISTEN   0         128                0.0.0.0:22               0.0.0.0:*
LISTEN   0         70                       *:33060                  *:*
LISTEN   0         128                      *:3306                   *:*
LISTEN   0         128                   [::]:22                  [::]:*
[root@MySQL-Server ~]#mysql
mysql> create database kodbox;
Query OK, 1 row affected (0.00 sec)

mysql> create user kodbox@'10.0.0.%' identified by '123456';
Query OK, 0 rows affected (0.01 sec)

mysql> grant all on kodbox.* to kodbox@'10.0.0.%';
Query OK, 0 rows affected (0.01 sec)

4.配置redis

[root@Redis-Server ~]#yum -y install redis
[root@Redis-Server ~]#systemctl enable --now redis
[root@Redis-Server ~]#ss -ntl
State     Recv-Q    Send-Q         Local Address:Port         Peer Address:Port    Process
LISTEN    0         128                127.0.0.1:6379              0.0.0.0:*
LISTEN    0         128                  0.0.0.0:22                0.0.0.0:*
LISTEN    0         128                     [::]:22                   [::]:*
[root@Redis-Server ~]#vim /etc/redis.conf
#bind 127.0.0.1 #修改为 bind 0.0.0.0
[root@Redis-Server ~]#systemctl restart redis

5.配置php

[root@LNP-Server ~]#vim /etc/php.ini
upload_max_filesize = 200M

#修改以下内容

[root@LNP-Server ~]#systemctl restart php-fpm.service

 

 

[root@LNP-Server ~]#vim /etc/php-fpm.d/www.conf #修改文件
user = nginx
group = nginx
listen = 127.0.0.1:9000
pm.status_path = /fpm_status
ping.path = /pong
#安装模块包
[root@LNP-Server ~]#wget https://pecl.php.net/get/redis-5.3.7.tgz
[root@LNP-Server ~]#tar xf redis-5.3.7.tgz
[root@LNP-Server ~]#cd redis-5.3.7/
[root@LNP-Server redis-5.3.7]#yum -y install  php-cli php-devel
[root@LNP-Server redis-5.3.7]#phpize
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
[root@LNP-Server redis-5.3.7]#./configure
[root@LNP-Server redis-5.3.7]#make -j 2 && make install
.............................
See any operating system documentation about shared libraries for

## more information, such as the ld(1) and ld.so(8) manual pages.

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/lib64/php/modules/
[root@LNP-Server redis-5.3.7]#ll /usr/lib64/php/modules/
[root@LNP-Server redis-5.3.7]#vim /etc/php.d/31-redis.ini
;listen = /run/php-fpm/www.sock

extension=redis
[root@LNP-Server redis-5.3.7]#systemctl enable --now php-fpm

[root@LNP-Server redis-5.3.7]#ss -ntl
State      Recv-Q     Send-Q           Local Address:Port           Peer Address:Port     Process
LISTEN     0          128                  127.0.0.1:9000                0.0.0.0:*
LISTEN     0          128                    0.0.0.0:111                 0.0.0.0:*
LISTEN     0          128                    0.0.0.0:80                  0.0.0.0:*
LISTEN     0          128                    0.0.0.0:22                  0.0.0.0:*
LISTEN     0          128                       [::]:111                    [::]:*
LISTEN     0          128                       [::]:22                     [::]:*
#下载可到云
[root@rocky8 ~]#wget https://static.kodcloud.com/update/download/kodbox.1.27.zip
[root@rocky8 ~]#mv kodbox.1.27.zip /data/php/
[root@rocky8 ~]#cd /data/php/
[root@rocky8 php]#unzip kodbox.1.27.zip
[root@rocky8 ~]#chown -R nginx.nginx /data/php

打开浏览器输入www.jason.org

 填写信息

 设置密码

 

 

 

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zhu1241jie

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值