手撕包菜SSBC DHT磁力搜索程序 PHP前端 安装使用 图文教程

来源: 老季博客
日期: 2016-9-19
作者: 腾讯云/服务器VPS推荐评测/Vultr
阅读数: 96

前面我们介绍了手撕包菜的的安装教程,但是群里有一些小伙伴想使用PHP的前端,但是不知道如何下手。

下面我们就写一个教程给大家,我们这里PHP环境就直接yum安装。

本教程仅供学习使用,PHP前端由群友提供,老季并不能保证没有木马等其他信息,请自行斟酌!!!

手撕包菜SSBC(DHT磁力链源码) 2016.8月版 安装图文教程

手撕包菜SSBC(DHT磁力链源码) 前端使用 Nginx反向代理 80端口 图文教程

我们这里的安装环境为Vultr?CentOS 7 x64

CPU:1 vCore ? ?Ram:768 MB ? ?Storage:15 GB SSD
yum update -y
yum install screen wget unzip gcc gcc-c++ python-devel -y
systemctl stop firewalld.service ;?systemctl disable firewalld.service
  • ?安装配置php、mysql环境

Centos 7 Yum安装 Nginx 图文教程

CentOS yum安装PHP5.6 图文教程

CentOS 5, CentOS 6, CentOS 7, RHEL 5, RHEL 6, RHEL 7, and Fedora 21 yum 安装 MariaDB 图文教程

创建网站环境及目录:

mkdir /wwwroot/laoji.org -p
echo '<?php phpinfo();' > /wwwroot/laoji.org/Info.php

配置php-fpm环境:

vi /etc/nginx/php-fpm.conf

添加如下内容:

 location ~ \.php$ {
     fastcgi_pass 127.0.0.1:9000;
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #这里写错可能会导致404,403 fobidden错误
     include fastcgi_params;
 }

修改nginx配置文件, /etc/nginx/nginx.conf:

?vi /etc/nginx/nginx.conf

修改root目录:

root /wwwroot/laoji.org;

添加:

include php-fpm.conf;

手撕包菜SSBC DHT磁力搜索程序 PHP前端 安装使用 图文教程

添加程序的rewrite规则:

location / {
    if (!-e $request_filename){
        rewrite (.*) /index.php;
    }
}
location ^~ /protected {
    deny all;
}
nginx -t
systemctl restart nginx.service

通过IP访问确定PHP正常工作。

手撕包菜SSBC DHT磁力搜索程序 PHP前端 安装使用 图文教程

  • 获取ssbc安装包并解压

wget https://github.com/78/ssbc/archive/master.zip ; unzip master.zip ; cd ssbc-master/

解压后你会发现在/root目录下有个文件夹ssbc-master

  • 安装python爬虫运行环境

yum install -y MySQL-python python-pip mariadb mariadb-devel mariadb-server zlib-devel 
pip install pygeoip 
wget https://bootstrap.pypa.io/get-pip.py ; python get-pip.py;pip install -r requirements.txt
  • 安装Sphinx

yum -y install unixODBC unixODBC-devel postgresql-libs php56-php-pecl-sphinx sphinx-php
wget http://sphinxsearch.com/files/sphinx-2.2.9-1.rhel7.x86_64.rpm
rpm -ivh sphinx-2.2.9-1.rhel7.x86_64.rpm
  • 新建名为ssbc的数据库

 mysql -uroot -p &nbsp; &nbsp; &nbsp;#如mysql没有密码直接回车即可

手撕包菜SSBC DHT磁力搜索程序 PHP前端 安装使用 图文教程

  • 建立文件夹,创建以下文件夹并赋予755权限

mkdir -p /data/bt/index/db /data/bt/index/binlog /tem/downloads
chmod 755 -R /data
chmod 755 -R /tem
  • 生成索引

cd /root/ssbc-master/
indexer -c sphinx.conf --all //(all 前面是空格减号减号) 
searchd --config ./sphinx.conf  //(config前是空格减号减号)
  • 配置Python爬虫,运行爬虫、索引

cd /root/ssbc-master/workers/
python manage.py makemigrations
python manage.py migrate

运行爬虫:

screen -S simdht
cd /root/ssbc-master/workers/
python simdht_worker.py

看到如下图所示的即为运行正常:
手撕包菜SSBC DHT磁力搜索程序 PHP前端 安装使用 图文教程

ctrl+a,d退出screen

运行索引:

screen -S index
cd /root/ssbc-master/workers/
python index_worker.py

手撕包菜SSBC DHT磁力搜索程序 PHP前端 安装使用 图文教程

ctrl+a,d退出screen

运行后台:

cd /root/ssbc-master/
python manage.py createsuperuser           #创建后台管理员
python manage.py runserver 0.0.0.0:8080 >/dev/zero &            #运行后台程序
  • 上传PHP文件至 /wwwroot/laoji.org

从群里上传PHP前端文件到 ?/wwwroot/laoji.org

手撕包菜SSBC DHT磁力搜索程序 PHP前端 安装使用 图文教程

设定目录权限:

chmod 777 /wwwroot/laoji.org/tmp/ -R

浏览器打开即可访问:
手撕包菜SSBC DHT磁力搜索程序 PHP前端 安装使用 图文教程

手撕包菜SSBC DHT磁力搜索程序 PHP前端 安装使用 图文教程

手撕包菜SSBC DHT磁力搜索程序 PHP前端 安装使用 图文教程

教程先到这里,如果有什么疑问的话,大家可以在群里一起交流学习。

链接到文章: https://jiloc.com/42786.html

2 replies on “手撕包菜SSBC DHT磁力搜索程序 PHP前端 安装使用 图文教程”

ssbc说道:

胡扯。表结构都不一样

表结构是我们自己适配的亲。

回复 VPS推荐评测/搬瓦工优惠码 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注