有nyaa/sukebeinyaa/btsow,使用起来还是很爽的,至少手机以后搜索要方便很多了,不会弹乱七八糟的广告。这个程序是Java写的,有war包,可以直接拖到Tomcat上面跑,下面我在CentOS7写一下安装步骤。。
首先添加一个Tomcat用户:
useradd -m -d /opt/tomcat -s /sbin/nologin -U tomcat
下载最新版的Tomcat:
yum -y update yum -y install java-1.8.0 wget wget https://www.apache.org/dist/tomcat/tomcat-9/v9.0.21/bin/apache-tomcat-9.0.21.tar.gz tar -xzvf apache-tomcat-9.0.21.tar.gz -C /opt cp -r /opt/apache-tomcat-9.0.21/. /opt/tomcat rm -rf /opt/apache-tomcat-9.0.21
设置正确的权限:
chown -R tomcat:tomcat /opt/tomcat
新建systemd服务文件:
nano /etc/systemd/system/tomcat.service
写入如下配置:
[Unit] Description=Apache Tomcat 9 Server After=network.target [Service] Type=forking User=tomcat Group=tomcat UMask=0007 RestartSec=10 Restart=always Environment=JAVA_HOME=/usr/lib/jvm/jre Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom" Environment=CATALINA_BASE=/opt/tomcat Environment=CATALINA_HOME=/opt/tomcat Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC" ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/opt/tomcat/bin/shutdown.sh [Install] WantedBy=multi-user.target
使用systemd管理tomcat:
systemctl start tomcat systemctl enable tomcat systemctl status tomcat
如果正常运行,你将可以看到类似下图的回显:
现在访问你的服务器IP:8080应该可以看到这个界面:
接着添加Tomcat的管理员账号:
nano /opt/tomcat/conf/tomcat-users.xml
加入如下配置:
默认管理界面的WEBUI不允许通过外部访问,所以编辑如下文件:
nano /opt/tomcat/webapps/manager/META-INF/context.xml
把这段注释掉:
这个文件也和之前一样改动一下:
nano /opt/tomcat/webapps/host-manager/META-INF/context.xml
还是一样注释如图的部分:
重启Tomcat:
systemctl restart tomcat
现在下载项目文件到webapps目录:
cd /opt/tomcat/webapps wget https://github.com/dengyuhan/magnetW/releases/download/2.0.6/magnetw-2.0.6.war
编辑配置文件:
nano /opt/tomcat/webapps/magnetw-2.0.6/WEB-INF/classes/config.properties
我的改动如下:
search.placeholder=妹子 version.link=https://lala.im busuanzi.enabled=true busuanzi.show=true proxy.ignore=false
站点标题可以修改这个文件进行更改:
nano /opt/tomcat/webapps/magnetw-2.0.6/WEB-INF/views/index.jsp
改完之后可以通过WEBUI将应用重启使更改生效:
当然你也可以直接重启Tomcat:
systemctl restart tomcat
安装Caddy进行反向代理/绑定域名/SSL:
curl https://getcaddy.com | bash -s personal mkdir -p /etc/caddy && mkdir -p /etc/ssl/caddy nano /etc/caddy/Caddyfile
写入:
bt.koko.cat { log stdout gzip tls [email protected] proxy / http://139.162.125.54:8080/magnetw-2.0.6 { header_upstream Host {host} header_upstream X-Real-IP {remote} header_upstream X-Forwarded-For {remote} header_upstream X-Forwarded-Port {server_port} header_upstream X-Forwarded-Proto {scheme} } }
新建systemd服务文件:
nano /etc/systemd/system/caddy.service
写入:
[Unit] Description=Caddy HTTP/2 web server Documentation=https://caddyserver.com/docs After=network-online.target Wants=network-online.target systemd-networkd-wait-online.service [Service] Restart=on-abnormal User=root Group=root Environment=CADDYPATH=/etc/ssl/caddy ExecStart=/usr/local/bin/caddy -log stdout -agree=true -conf=/etc/caddy/Caddyfile ExecReload=/bin/kill -USR1 $MAINPID KillMode=mixed KillSignal=SIGQUIT TimeoutStopSec=5s [Install] WantedBy=multi-user.target
启动Caddy:
systemctl start caddy systemctl enable caddy
需要用到的端口80/8080/443,
firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https firewall-cmd --permanent --add-port=8080/tcp firewall-cmd --reload
演示站(24h销毁):
https://bt.koko.cat
这是什么,我萌新什么都不知道:
演示站那个BTSOW不能用,应该不是程序有问题而是这个站不知道为啥把我这台小鸡的IP给屏蔽了:
[root@li1609-54 ~]# curl -I https://btsow.pw HTTP/1.1 403 Forbidden VBL Server: nginx Date: Wed, 03 Jul 2019 08:56:59 GMT Content-Length: 0 Connection: keep-alive Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0 Pragma: no-cache
LALA
我什么都不卖了,告辞!
最新评论
5211314
能不能教我 一点不会