Jrohy / trojan

trojan多用户管理部署程序, 支持web页面管理
GNU General Public License v3.0
5.46k stars 1.53k forks source link

web后台修改了端口后,切换go不成功,重启服务器,trojan服务启动不起来 #363

Closed totodata closed 3 years ago

totodata commented 3 years ago

按照wiki,修改后admin后台的端口。 在后台切换go失败, 重启服务器,trojan服务启动不起来

还有如何加一个自定义web站点在默认80下

Jrohy commented 3 years ago

自定义web站点得自己找下web伪装的html放到nginx 80的/路径下

totodata commented 3 years ago

只要改了端口,在后台trojan进行任何操作,都是失败。

[INFO] 2021/01/12 14:47:10 trojan-go v0.8.2 initializing [FATAL] 2021/01/12 14:47:10 github.com/p4gefau1t/trojan-go/proxy.(Node).BuildNext:stack.go:29 invalid redirect address. check your http server: 127.0.0.1:80 | dial tcp 127.0.0.1:80: connect: connection refused trojan.service: main process exited, code=exited, status=1/FAILURE Unit trojan.service entered failed state. trojan.service failed. trojan.service holdoff time over, scheduling restart. Stopped trojan-go. Started trojan-go. [INFO] 2021/01/12 14:47:13 trojan-go v0.8.2 initializing [FATAL] 2021/01/12 14:47:13 github.com/p4gefau1t/trojan-go/proxy.(Node).BuildNext:stack.go:29 invalid redirect address. check your http server: 127.0.0.1:80 | dial tcp 127.0.0.1:80: connect: connection refused trojan.service: main process exited, code=exited, status=1/FAILURE Unit trojan.service entered failed state. trojan.service failed. trojan.service holdoff time over, scheduling restart. Stopped trojan-go. Started trojan-go. [INFO] 2021/01/12 14:47:17 trojan-go v0.8.2 initializing [FATAL] 2021/01/12 14:47:17 github.com/p4gefau1t/trojan-go/proxy.(Node).BuildNext:stack.go:29 invalid redirect address. check your http server: 127.0.0.1:80 | dial tcp 127.0.0.1:80: connect: connection refused trojan.service: main process exited, code=exited, status=1/FAILURE Unit trojan.service entered failed state. trojan.service failed. trojan.service holdoff time over, scheduling restart. Stopped trojan-go. Started trojan-go. [INFO] 2021/01/12 14:47:20 trojan-go v0.8.2 initializing [FATAL] 2021/01/12 14:47:20 github.com/p4gefau1t/trojan-go/proxy.(Node).BuildNext:stack.go:29 invalid redirect address. check your http server: 127.0.0.1:80 | dial tcp 127.0.0.1:80: connect: connection refused trojan.service: main process exited, code=exited, status=1/FAILURE Unit trojan.service entered failed state. trojan.service failed.

totodata commented 3 years ago

默认的html根目录在哪呢?

Jrohy commented 3 years ago

改错了吧,应该是改trojan-web的端口,而不是trojan本身的端口,看清楚wiki改端口那部分

Jrohy commented 3 years ago

web文件没有释放出来,而是在bin文件里面的

totodata commented 3 years ago

没有改错的 trojan-web.service

ExecStart=/usr/local/bin/trojan web -p 端口号

Jrohy commented 3 years ago

80端口的nginx启动成功了吗,trojan-go要转发非trojan流量到80的

totodata commented 3 years ago

80端口的nginx需要另外安装是吗?怎么安装呢。

Jrohy commented 3 years ago

yum install nginx 或者apt-get install nginx

totodata commented 3 years ago

然后按照wiki那样修改nginx默认配置文件对吧。

/etc/nginx/nginx.conf

    location /admin {
        proxy_pass   http://localhost:81/;
    }
    location ~* ^/(js|css|vendor|common|auth|trojan)/ {
        proxy_pass  http://localhost:81;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
    }
    # http强制跳转到https
    if ( $remote_addr != 127.0.0.1 ){
        rewrite ^/(.*)$ https://example.com/$1 redirect;
    } 
Jrohy commented 3 years ago

是的

totodata commented 3 years ago

80网站可以访问了,可是所有css js都没生效。

totodata commented 3 years ago

安装玩nginx,应该加入自动启动服务。才能正常。

systemctl enable nginx.service