搭建论坛及基于华为云OBS的私人共享网盘

简介

主页:https://www.buxue66.com

安装nginx

root@hecs-x-medium-2-win-20200619090054:~# sudo apt install nginx

安装mysql

  1. 数据库安装及初始化

    root@hecs-x-medium-2-win-20200619090054:~# sudo apt install mysql-server-8.0 mysql-client-8.0  //安装
    
    root@hecs-x-medium-2-win-20200619090054:~# sudo mysql -u root  //登录mysql
    
    mysql> use mysql ;  //使用数据库
    
    mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root' ;  //初始化密码,密码为空
    
    mysql> FLUSH PRIVILEGES ;  //更改生效
    
    mysql> exit
    
  2. 重启数据库

    root@hecs-x-medium-2-win-20200619090054:~# sudo service mysql restart
    
  3. 再次登录mysql,修改密码

    root@hecs-x-medium-2-win-20200619090054:~# sudo mysql -u root  //再次登录
    
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456' ;  //更改密码
    
    mysql> exit
    
  4. 创建数据库

    root@hecs-x-medium-2-win-20200619090054:~# mysql -u root -p  //登录数据库
    
    mysql> CREATE DATABASE forum ;  //创建wordpress或者forum数据库
    
    mysql> FLUSH PRIVILEGES ;
    
    mysql> exit
    

安装php

  1. 安装

    root@hecs-x-medium-2-win-20200619090054:~# sudo apt install php7.4-fpm php7.4-mysql php7.4 php7.4-gd php7.4-cgi php7.4-curl php7.4-mbstring php7.4-zip php7.4-dom php7.4-exif php7.4-fileinfo php7.4-json  php7.4-bcmath php7.4-mbstring openssl php7.4-tokenizer php7.4-imagick php7.4-iconv
    
  2. 查看安装插件是否完整

    root@hecs-x-medium-2-win-20200619090054:~# php -m
    
  3. 查看php.ini位置

    php --ini
    php -i | grep php.ini
    

配置nginx,开启https(需提前申请好ssl证书)

  1. 上传证书server.crt server.key至cert文件夹

    root@hecs-x-medium-2-win-20200619090054:~# cd /etc/nginx
    root@hecs-x-medium-2-win-20200619090054:~# mkdir cert
    
  2. 启用php

    root@hecs-x-medium-2-win-20200619090054:~# sudo vim /etc/nginx/sites-available/default 
    
    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
            ssl on;
            #
            # Read up on ssl_ciphers to ensure a secure configuration.
            # See: https://bugs.debian.org/765782
            ssl_certificate /etc/nginx/cert/server.crt;
            #
            # Self signed certs generated by the ssl-cert package
            # Don't use them in a production server!
            ssl_certificate_key /etc/nginx/cert/server.key;
            #
            # include snippets/snakeoil.conf;
    
            root /var/www/html;
    
            # Add index.php to the list if you are using PHP
            index index.php index.html index.htm index.nginx-debian.html;
    
            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:/var/run/php/php7.4-fpm.sock;
            #       # With php-cgi (or other tcp sockets):
            #       #fastcgi_pass 127.0.0.1:9000;
            }
    
            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            #location ~ /\.ht {
            #       deny all;
            #}
    }
    server {
            listen 80;
            server_name  buxue66.com www.buxue66.com;
            return 301 https://$server_name$request_uri;
    }
    
    root@hecs-x-medium-2-win-20200619090054:~# sudo service nginx restart
    

下载论坛

https://gitee.com/Discuz/DiscuzX/attach_files

安装论坛

  1. 把文件复制到相应文件夹

    root@hecs-x-medium-2-win-20200619090054:~# cd /var/www/html/forum
    root@hecs-x-medium-2-win-20200619090054:~# sudo apt install unrar
    root@hecs-x-medium-2-win-20200619090054:~# unrar x unload.rar
    root@hecs-x-medium-2-win-20200619090054:~# rm -rf unload.rar
    ``
    
    
  2. 给权限

    root@hecs-x-medium-2-win-20200619090054:~# cd /var/www/html
    root@hecs-x-medium-2-win-20200619090054:~# chown -R www-data:www-data forum
    root@hecs-x-medium-2-win-20200619090054:~# cd /var/www/html
    root@hecs-x-medium-2-win-20200619090054:~# chmod 777 -R /var/www/html/forum/config
    root@hecs-x-medium-2-win-20200619090054:~# chmod 777 -R /var/www/html/forum/data
    root@hecs-x-medium-2-win-20200619090054:~# chmod 777 -R /var/www/html/forum/uc_client/data/cache 
    root@hecs-x-medium-2-win-20200619090054:~# chmod 777 -R /var/www/html/forum/uc_server/data/
    

安装phpadmin

  1. 下载安装包

    https://www.phpmyadmin.net/files/5.0.4/
    
  2. 安装

    cd /var/www/html
    root@hecs-x-medium-2-win-20200619090054:~# tar -xvf phpMyAdmin-5.0.4-all-languages.tar.gz 
    root@hecs-x-medium-2-win-20200619090054:~# mv phpMyAdmin-5.0.4-all-languages phpmyadmin
    root@hecs-x-medium-2-win-20200619090054:~# rm -rf phpMyAdmin-5.0.4-all-languages.tar.gz
    root@hecs-x-medium-2-win-20200619090054:~# cd /var/www/html/phpmyadmin
    root@hecs-x-medium-2-win-20200619090054:~# mkdir tmp
    root@hecs-x-medium-2-win-20200619090054:~# chmod 777 tmp
    

搭建基于华为云OBS存储的私人共享网盘

  1. 下载安装zfile

    root@hecs-x-medium-2-win-20200619090054:~# cd /var/www/http
    root@hecs-x-medium-2-win-20200619090054:~# wget https://c.jun6.net/ZFILE/zfile-release.war
    root@hecs-x-medium-2-win-20200619090054:~# mkdir zfile && unzip zfile-2.8.war -d zfile && rm -rf zfile-2.8.war
    root@hecs-x-medium-2-win-20200619090054:~# chmod +x zfile/bin/*.sh
    root@hecs-x-medium-2-win-20200619090054:~# /var/www/http/zfile/bin/start.sh
    
  2. 查看 www-data 用户组id及用户id
    root@hecs-x-medium-2-win-20200619090054:~# vim /etc/group
    root@hecs-x-medium-2-win-20200619090054:~# vim /etc/passwd

  3. 安装golang

    查看go最新版本https://golang.org/dl/?spm=a2c4e.10696291.0.0.24e019a4Os8BGw

    root@hecs-x-medium-2-win-20200619090054:~# wget -c https://dl.google.com/go/go1.16.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
    root@hecs-x-medium-2-win-20200619090054:~# export PATH=$PATH:/usr/local/go/bin
    root@hecs-x-medium-2-win-20200619090054:~# source ~/.profile
    root@hecs-x-medium-2-win-20200619090054:~# go version
    root@hecs-x-medium-2-win-20200619090054:~# sudo apt -y install fuse
    
  4. 下载goofys,挂在华为云OBS

    下载地址

    https://github-releases.githubusercontent.com/42475296/92e1ec00-768c-11ea-82dd-825b7e124210?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210223%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210223T061555Z&X-Amz-Expires=300&X-Amz-Signature=7c1633a1322c3a32885fee2259ce22b24686394d0e3955c807a75bf17e2029d7&X-Amz-SignedHeaders=host&actor_id=67353850&key_id=0&repo_id=42475296&response-content-disposition=attachment%3B%20filename%3Dgoofys&response-content-type=application%2Foctet-stream
    

    安装goofys,挂在华为云OBS

    root@hecs-x-medium-2-win-20200619090054:~# cd /usr/local/go/bin/
    root@hecs-x-medium-2-win-20200619090054:~# chmod +x goofys
    root@hecs-x-medium-2-win-20200619090054:~# cd /root
    root@hecs-x-medium-2-win-20200619090054:~# goofys --version
    root@hecs-x-medium-2-win-20200619090054:~# mkdir .aws
    root@hecs-x-medium-2-win-20200619090054:~# cd .aws
    root@hecs-x-medium-2-win-20200619090054:~# sudo vi credentials
    
    [default]
    aws_access_key_id = FZY*****************
    aws_secret_access_key = O2CDV**********************************
    
    root@hecs-x-medium-2-win-20200619090054:~# goofys --dir-mode 0777 --file-mode 0777 -o allow_other --uid 33 --gid 33 --endpoint https://obs.cn-east-3.myhuaweicloud.com --region cn-east-3 buxue66 /var/www/html/archivedfile
    root@hecs-x-medium-2-win-20200619090054:~# df -h
    
  5. 添加记录集

    华为云控制台-域名注册-域名解析-添加记录集

  6. 反向代理zfile

    server {
        listen 80;
        server_name  file.buxue66.com www.file.buxue66.com;
    
        location / {
            proxy_pass http://127.0.0.1:8080;
            index  index.html index.htm index.jsp;
        }
    }
    
    root@hecs-x-medium-2-win-20200619090054:~# sudo service nginx restart
    

以上只是我不成熟的探索,很多因设置太麻烦不适合大部分人,用以上开源软件搭建的网站已经弃用。

这是我最新搭建的网站,供大家参考。

主页:https://www.zuodianshier.net
论坛:https://bbs.zuodianshier.net
网盘:https://files.zuodianshier.net

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值