1 year ago

#2194

test-img

haofunny

How to configure trojan to make it fall back to the site correctly?

I use the mirror jwilder/nginx-proxy to automatically HTTPS, and I deploy the trojan-go service through the compose.yml file. The content of the compose.yml file is shown below. I can open the HTTPS website correctly by the domain name, but trojan-go does not fall back to the website correctly, and the log shows github.com/p4gefau1t/trojan-go/proxy.(*Node).BuildNext:stack.go:29 invalid redirect address. check your http server: trojan_web:80 | dial tcp 172.18.0.2:80: connect: connection refused, where is the problem? thank you very much!

    version: '3'
    services:
      trojan-go:
        image: teddysun/trojan-go:latest
        restart: always
                          
        volumes:
          - ./config.json:/etc/trojan-go/config.json
          - /opt/trojan/nginx/certs/:/opt/crt/:ro
          
        environment:
          - "VIRTUAL_HOST=domain name"
          - "VIRTUAL_PORT=38232"
          - "LETSENCRYPT_HOST=domain name"
          - "LETSENCRYPT_EMAIL=xxx@gmail.com"
        
        
        expose:
          - "38232"
      
  web1:
    image: nginx:latest
    restart: always
    expose:
      - "80"
      
    volumes:
      - /opt/trojan/nginx/html:/usr/share/nginx/html:ro
      
     
    environment:
      - VIRTUAL_HOST=domain name
      - VIRTUAL_PORT=80
      - LETSENCRYPT_HOST=domain name
      - LETSENCRYPT_EMAIL=xxx@gmail.com
     
 
      
networks:
  default:
    external:
      name: proxy_nginx-proxy

the content of trojan-go config.conf is shown below:

{
  "run_type": "server",
  "local_addr": "0.0.0.0",
  "local_port": 38232,
  "remote_addr": "trojan_web",
  "remote_port": 80,
  "log_level": 1,
  
  "password": [
       "mypasswd"
  ],
 
  
  "ssl": {
    "verify": true,
    "verify_hostname": true,
    "cert": "/opt/crt/domain name.crt",
    "key": "/opt/crt/domain name.key",
    "sni":"domain name"
    },
"router":{
"enabled": true,
"block": [
"geoip:private"
]
}
}

(ps:I confirm that the trojan-go service and the web container are on the same intranet and can communicate with each other)

web

trojan

0 Answers

Your Answer

Accepted video resources