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

前面我们写了手撕包菜SSBC(DHT磁力链源码) 2016.8月版 安装图文教程,下面我们写一下如何在前端添加Nginx做反向代理,增加并发能力。

示例环境:

Linode 2048

24GB DISK1 CPU Core2TB XFER.015/hr to $10/mo

系统:CentOS 7

Linode优惠码 – 13周年内存免费大升级

Nginx安装:

yum install -y nginx

[[email protected] ~]# yum install nginx
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* extras: mirrors.linode.com
* updates: mirrors.linode.com
No package nginx available.
Error: Nothing to do

如果没有Nginx的yum源,请移步:Centos 7 Yum安装 Nginx 图文教程

手撕包菜SSBC DHT磁力 配置部分:

kill掉 手撕包菜的进程,否则会出现Nginx无法启动并提示80端口被占用

检测python 80端口进程ID:

ps aux | grep python

[[email protected] ~]# ps aux | grep python
root 3454 0.0 0.0 553044 472 ? Ssl Aug13 0:28 /usr/bin/python -Es /usr/sbin/tuned -l -P
root 7690 0.0 0.0 266868 1016 ? S Aug13 0:02 python workers/index_worker.py
root 9095 0.0 0.0 327868 12 ? S Aug13 0:00 python manage.py runserver 0.0.0.0:80
root 9109 1.2 1.2 638008 25120 ? Sl Aug13 33:21 /usr/bin/python manage.py runserver 0.0.0.0:80
root 19302 0.0 0.1 112660 2212 pts/0 S+ 07:08 0:00 grep –color=auto python

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

kill -9 9095 9109

重新新建手撕包菜SSBC的进程:

nohup python manage.py runserver 0.0.0.0:8080 >/dev/zero &

注意命令行中的manage.py的位置,进入到/root/ssbc-master文件夹再运行。使用http://IP:8080 访问下,确保8080端口工作正常.如出现无法访问,检查一下防火墙配置,是否允许8080端口通过。

配置Nginx反向代理:

编辑配置文件:

vi /etc/nginx/conf.d/jiloc.com.conf

填入一下内容:

server{  ? ? listen 80;  ? ? server_name jiloc.com;  ? ? location / {  ? ? ? ? proxy_pass http://ip地址:8080/;  ? ? ? ? proxy_redirect off;  ? ? ? ? proxy_set_header X-Real-IP $remote_addr;  ? ? ? ? proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  ? ? }  }

nginx测试配置文件:

nginx -t

[[email protected] ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

reload nginx配置:

systemctl reload nginx.service

再次访问80端口,如果正常及表示反向代理配置已成功!

腾讯云限时秒杀【点击购买】

搬瓦工,CN2高速线路,1GB带宽,电信联通优化KVM,延迟低,速度快,建站稳定,搬瓦工BandwagonHost VPS优惠码BWH26FXH3HIQ,支持<支付宝> 【点击购买】!

Vultr$3.5日本节点,512M内存/500G流量/1G带宽,电信联通优化,延迟低,速度快【点击购买】!

阿里云香港、新加坡VPS/1核/1G/25G SSD/1T流量/30M带宽/年付¥288【点击购买】

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

`微信`扫码 加好友

链接到文章: https://gkxyz.com/shousibaocaissbcdhtcililianyuanma-qianduanshiyong-nginxfanxiangdaili-80duankou-tuwenjiaocheng.html

推荐站点

评论已关闭