Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问能否出一个手动配置的教程? #38

Closed
onlyJinx opened this issue Mar 31, 2020 · 20 comments
Closed

请问能否出一个手动配置的教程? #38

onlyJinx opened this issue Mar 31, 2020 · 20 comments

Comments

@onlyJinx
Copy link

原因是我目前的服务器上已经有Trojan, 使用前置Nginx 然后用SNI预读分流给V2ran和trojan的,所以配置文件被我搞得有点乱, 所以用一键脚本的话可能会有点问题, 所以想问问能否出一个手动配置的教程? 谢谢.

@Jrohy
Copy link
Owner

Jrohy commented Mar 31, 2020

原先有trojan的话,会被覆盖掉的,你可以手动下载二进制文件来运行, ./trojan web

@onlyJinx
Copy link
Author

如果直接运行./trojan web 的话原来的trojan config会保持不变吗? 还有web端的话是由我原来的nginx来负责还是让trojan接管?

@Jrohy
Copy link
Owner

Jrohy commented Mar 31, 2020

web端是和二进制文件放一起的。你可以起用./trojan web -p xxx 指定其他端口,而80留个nginx, 让nginx转发过去

@onlyJinx
Copy link
Author

我试着用你教的方法运行起来了, 但是好像对接不到我已有的trojan,这个有办法解决吗,谢谢

image

@Jrohy
Copy link
Owner

Jrohy commented Mar 31, 2020

你的trojan是安装在什么目录呢, https://github.com/trojan-gfw/trojan-quickstart 官方的这个脚本是安装在/usr/local/bin目录下

@Jrohy
Copy link
Owner

Jrohy commented Mar 31, 2020

本项目因为要用到全局trojan命令,所以将trojan安装到/usr/bin/trojan/trojan, 而管理程序就放到/usr/local/bin/下面,输入trojan就可以进入管理程序

@onlyJinx
Copy link
Author

二进制文件放在/etc/trojan/ 下, 那我ln-s 到 /usr/local/bin?
image

@Jrohy
Copy link
Owner

Jrohy commented Mar 31, 2020

应该指向这里/usr/bin/trojan/trojan, 可以试试

@onlyJinx
Copy link
Author

嗯,ln后可以识别版本号了,但是无法添加trojan用户,点击确认没反应, 后台log如下

image

[root@RUO ~]# ./trojan web -p 4544
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.

  • using env: export GIN_MODE=release
  • using code: gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET /auth/check --> trojan/web.Auth.func2 (5 handlers)
[GIN-debug] POST /auth/login --> github.com/appleboy/gin-jwt/v2.(*GinJWTMiddleware).LoginHandler-fm (5 handlers)
[GIN-debug] POST /auth/register --> trojan/web.updateUser (5 handlers)
[GIN-debug] POST /auth/reset_pass --> trojan/web.updateUser (6 handlers)
[GIN-debug] POST /auth/logout --> github.com/appleboy/gin-jwt/v2.(*GinJWTMiddleware).LogoutHandler-fm (6 handlers)
[GIN-debug] POST /auth/refresh_token --> github.com/appleboy/gin-jwt/v2.(*GinJWTMiddleware).RefreshHandler-fm (6 handlers)
[GIN-debug] GET /trojan/user --> trojan/web.userRouter.func1 (6 handlers)
[GIN-debug] POST /trojan/user --> trojan/web.userRouter.func2 (6 handlers)
[GIN-debug] DELETE /trojan/user --> trojan/web.userRouter.func3 (6 handlers)
[GIN-debug] POST /trojan/data --> trojan/web.dataRouter.func1 (6 handlers)
[GIN-debug] DELETE /trojan/data --> trojan/web.dataRouter.func2 (6 handlers)
[GIN-debug] GET /common/version --> trojan/web.commonRouter.func1 (6 handlers)
[GIN-debug] GET /common/serverInfo --> trojan/web.commonRouter.func2 (6 handlers)
[GIN-debug] POST /common/loginInfo --> trojan/web.commonRouter.func3 (6 handlers)
[GIN-debug] Listening and serving HTTP on :4544
open /usr/local/etc/trojan/config.json: no such file or directory

2020/03/31 06:05:56 [Recovery] 2020/03/31 - 06:05:56 panic recovered:
POST /trojan/user HTTP/1.1
Host: ruod.top:4544
Accept: application/json, text/plain, /
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7
Authorization: *
Content-Length: 246
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryog7mVCOtfWo1gI38
Cookie: jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODU2NTI3MTUsImlkIjoiYWRtaW4iLCJvcmlnX2lhdCI6MTU4NTY0OTExNX0.rWg0C6vrM5pdh8aAaeqtb2WU-XQ7cC8TDFAnFDV-kpI
Origin: http://ruod.top:4544
Referer: http://ruod.top:4544/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4093.3 Safari/537.36

runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:212 (0x44abe9)
/usr/local/go/src/runtime/signal_unix.go:687 (0x44aa38)
/home/go/trojan/core/server.go:74 (0xa4b88b)
/home/go/trojan/web/controller/user.go:50 (0xa4b871)
/home/go/trojan/web/web.go:29 (0xa4f7e7)
/home/go/pkg/mod/github.com/gin-gonic/gin@v1.5.0/context.go:147 (0xa2b1da)
/home/go/pkg/mod/github.com/appleboy/gin-jwt/v2@v2.6.3/auth_jwt.go:393 (0xa40660)
/home/go/pkg/mod/github.com/appleboy/gin-jwt/v2@v2.6.3/auth_jwt.go:355 (0xa435f3)
/home/go/pkg/mod/github.com/gin-gonic/gin@v1.5.0/context.go:147 (0xa2b1da)
/home/go/pkg/mod/github.com/gin-contrib/gzip@v0.0.1/gzip.go:47 (0xa4c690)
/home/go/pkg/mod/github.com/gin-gonic/gin@v1.5.0/context.go:147 (0xa2b1da)
/home/go/pkg/mod/github.com/gin-gonic/gin@v1.5.0/recovery.go:83 (0xa3e63f)
/home/go/pkg/mod/github.com/gin-gonic/gin@v1.5.0/context.go:147 (0xa2b1da)
/home/go/pkg/mod/github.com/gin-gonic/gin@v1.5.0/logger.go:241 (0xa3d770)
/home/go/pkg/mod/github.com/gin-gonic/gin@v1.5.0/context.go:147 (0xa2b1da)
/home/go/pkg/mod/github.com/gin-gonic/gin@v1.5.0/gin.go:403 (0xa34e52)
/home/go/pkg/mod/github.com/gin-gonic/gin@v1.5.0/gin.go:364 (0xa3455c)
/usr/local/go/src/net/http/server.go:2807 (0x75d8a2)
/usr/local/go/src/net/http/server.go:1895 (0x75921b)
/usr/local/go/src/runtime/asm_amd64.s:1373 (0x464c80)

@Jrohy
Copy link
Owner

Jrohy commented Mar 31, 2020

那个trojan配置文件,能否移动下,移动到/usr/local/etc/trojan/,还有mysql有没有安装呢

@Jrohy
Copy link
Owner

Jrohy commented Mar 31, 2020

安装了mysql后记得修改trojan配置文件,管理程序是读trojan配置文件来连mysql的

@Jrohy
Copy link
Owner

Jrohy commented Mar 31, 2020

你可以用管理程序安装管理那里可以安装mysql,移动完配置文件再来安装

@onlyJinx
Copy link
Author

请问数据库用mariadb(Centos默认)可以吗?如果用mariadb的话提示链接不上mysql, 还是一定要mysql?
image

@Jrohy
Copy link
Owner

Jrohy commented Mar 31, 2020

没测过,最好还是用mysql, 你可以用管理程序本身来安装mysql, 安装管理那里有

@onlyJinx
Copy link
Author

我发现mysql好大, 400多M, 大伙的trojan-panel用的好像是MariaDB不是mysql, 不知道以后您这个项目会不会支持MariaDB, 如果支持的话到时候再过来玩玩, 谢谢~

@Jrohy
Copy link
Owner

Jrohy commented Apr 14, 2020

有空我测下mysql版本和mariadb的兼容性

@Jrohy
Copy link
Owner

Jrohy commented Apr 14, 2020

我测了用docker版mariadb 没问题,貌似比mysql要省内存

@onlyJinx
Copy link
Author

就是说其他的都保持不变,直接把mysql换成mariadb也可以正常用对吧?我改天试一下,谢谢

@Jrohy
Copy link
Owner

Jrohy commented Apr 14, 2020

是的,https://github.com/go-sql-driver/mysql, 只要这个驱动支持的都能连,mysql8也是问题的

@onlyJinx
Copy link
Author

恩恩,我去试试,有问题再来请教~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants