前言

今天是一个搭建机场的教程,此教程只供研究学习

不可用于任何违反中华人民共和国或使用者所在地区法律法规的用途。

感谢作者的开源

作者地址:GitHub - v2board/v2board: 🚀A multiple proxy protocol manage panel application interface

准备工具

  1. 一台服务器或者是VPS(系统建议Centos7.9)
  2. SSH工具(Termius,Xshell,Putty等等)

环境

  1. Nginx1.17+
  2. MySQL 5.6+
  3. PHP 7.4+

教程开始

用ssh工具连接服务器,需要什么ssh工具可以看我之前的文章搭建独角数卡并搭建epusdt - M,s小站 (tyslz.cn)

0.关闭selinux

1
2
vim /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled,然后保存退出。

1.安装nginx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
yum -y install gcc gcc-c++ pcre pcre-devel openssl openssl-devel zlib zlib-devel gd gd-devel wget
groupadd www
useradd -s /sbin/nologin www -M -g www
wget https://nginx.org/download/nginx-1.20.2.tar.gz
tar -zxvf nginx-1.20.2.tar.gz
cd nginx-1.20.2
./configure --prefix=/usr/local/nginx \
--user=www \
--group=www \
--with-pcre \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_gzip_static_module \
--with-http_realip_module
make && make install
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx

2.安装MySQL

1
2
3
4
5
6
7
8
9
10
11
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
yum -y install mysql-community-server
systemctl start mysqld.service
grep "password" /var/log/mysqld.log
#上面会输出默认的密码
mysql -u root -p
输入默认密码进入数据库
mysql> set password for 'root'@'localhost'=password('输入你要设置的密码');
exit #退出数据库

3.安装PHP

1
2
3
4
5
6
yum install epel-release -y
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install yum-utils
yum-config-manager --enable remi-php74
yum install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json php-redis
ln -s /opt/remi/php74/root/usr/bin/php /usr/bin/php

4.安装git

1
yum install git -y

5.安装redis

1
2
3
4
5
6
cd
wget https://download.redis.io/redis-stable.tar.gz
tar -xzvf redis-stable.tar.gz
cd redis-stable
make
make install

6.安装v2board

1
2
3
4
5
6
7
mkdir -p /www/wwwroot/v2board
cd /www/wwwroot/v2board
git clone https://github.com/v2board/v2board.git ./
cd /
chmod 755 /www/*
chown -R www /www/*
cd /www/wwwroot/v2board

7.配置redis

1
2
3
4
5
6
7
8
9
10
cd redis-stable/
vim redis.conf

bind 127.0.0.1
daemonize yes
protected-mode yes
port 6379

#运行redis
redis-server redis.conf

8.添加数据库

1
2
3
mysql -u root -p
mysql>create database v2board;
exit

9.申请ssl证书(以腾讯云为例)

具体请看独角那篇文章

1
2
3
4
5
6
7
8
yum -y curl
https://get.acme.sh | sh
cd .acme.sh/dnsapi
vim dns_dp.sh
#将DP_Id和DP_Key的注释取消掉然后修改成自己的保存退出
acme.sh --issue --dns dns_dp -d domain.com -d *.domain.com --server letsencrypt
#domain.com换成自己的域名
将证书放在另一个位置一会要用

10.配置PHP

1
2
3
4
5
6
7
8
9
10
vim /etc/php.ini
#找见disable_functions =
disable_functions = system,exec,shell_exec,passthru,proc_close, proc_get_status,checkdnsrr,getmxrr,getservbyname,getservbyport, syslog,popen,show_source,highlight_file,dl,socket_listen,socket_create,socket_bind,socket_accept, socket_connect, stream_socket_server, stream_socket_accept,stream_socket_client,ftp_connect, ftp_login,ftp_pasv,ftp_get,sys_getloadavg,disk_total_space, disk_free_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
#将以上函数写入

vim /etc/php-fpm.d/www.conf
user = www
group = www
然后启动php-fpm
systemctl start php-fpm

10.配置nginx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
vim /usr/local/nginx/conf/nginx.conf

user www www;
worker_processes 1;

error_log logs/error.log;
error_log logs/error.log notice;
error_log logs/error.log info;

pid logs/nginx.pid;


events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;


sendfile on;
keepalive_timeout 65;


server {
listen 80;
server_name v2.lidocaine.cc;
return 301 https://$server_name$request_uri;
}


server {
listen 443 ssl;
server_name v2.lidocaine.cc;
root /www/wwwroot/v2board/public;
index index.html index.htm index.php;
ssl_certificate /www/wwwroot/v2board/fullchain.cer;
ssl_certificate_key /www/wwwroot/v2board/lidocaine.cc.key;

ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;

ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
try_files $uri $uri/ /index.php$is_args$query_string;
}
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 /downloads {

}

location ~ .*\.(js|css)?$
{
expires 1h;
error_log off;
access_log /dev/null;
}
}
}

11.启动v2board

1
2
cd /www/wwwroot/v2board
sh init.sh

根据提示填写即可

然后访问你的域名和管理地址,进入后台更改密码(一定一定一定要修改密码再继续)重要的事情说三遍

12.定时任务

1
2
croten -e
* * * * * php /www/wwwroot/v2board/artisan schedule:run > /dev/null

13.安装配置supervisor

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
yum install epel-release
yum install -y supervisor
supervisord -c /etc/supervisord.conf

#先把supervisor停止
supervisorctl shutdown
#修改配置文件
vim /etc/supervisord.conf
#将该文件最后一行修改为如下
[include]
files = supervisord.d/*.conf
#然后创建v2board配置文件
vim /etc/supervisord.d/v2board.conf
#写入以下代码
[program:v2board-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /www/wwwroot/v2board/artisan horizon
autostart=true
autorestart=true
user=www
numprocs=1
redirect_stderr=true
stdout_logfile=/www/wwwroot/v2board/storage/logs/horizon.log
#如果完全是按照教程走不需要修改
#启动
supervisord -c /etc/supervisord.conf
supervisorctl start v2board-worker:*
#每次更新都需要
supervisorctl update
supervisorctl reread

好了,这样就算配置完成了,可以去后台看看自己的其他配置了,需要对接tokenpay可以看我上一篇文章