Trojan服务部署
WsWHL Lv3

trojan-gfw

trojan-gfw

  • config

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    {
    "run_type": "server",
    "local_addr": "0.0.0.0",
    "local_port": 443,
    "remote_addr": "trojan-nginx",
    "remote_port": 80,
    "password": [
    "mypassword"
    ],
    "log_level": 1,
    "ssl": {
    "cert": "/cers/tls.crt",
    "key": "/cers/tls.key",
    "key_password": "",
    "cipher": "ECDHE-ECDSA-AES128-GCM-SHA256****",
    "cipher_tls13": "TLS_AES_128_GCM_SHA256***",
    "prefer_server_cipher": true,
    "alpn": [
    "http/1.1"
    ],
    "reuse_session": true,
    "session_ticket": false,
    "session_timeout": 600,
    "plain_http_response": "",
    "curves": "",
    "dhparam": ""
    },
    "tcp": {
    "prefer_ipv4": false,
    "no_delay": true,
    "keep_alive": true,
    "reuse_port": false,
    "fast_open": false,
    "fast_open_qlen": 20
    },
    "mysql": {
    "enabled": false,
    "server_addr": "trojan_db",
    "server_port": 3306,
    "database": "trojan",
    "username": "trojan",
    "password": "123456"
    }
    }

** 将tls证书放置/cers/目录*

nginx

  • 安装nginx软件包
    yum install nginx -y

  • 启动nginx服务

    1
    2
    systemctl enable nginx
    systemctl start nginx

trojan service

创建服务配置文件
vim /etc/systemd/system/trojan.service

  • 服务配置

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    [Unit]
    Description=trojan
    Documentation=man:trojan(1) https://trojan-gfw.github.io/trojan/config https://trojan-gfw.github.io/trojan/
    After=network.target

    [Service]
    Type=simple
    StandardError=journal
    User=nobody
    AmbientCapabilities=CAP_NET_BIND_SERVICE
    ExecStart=/usr/bin/trojan -c /etc/trojan/config.json
    ExecReload=/bin/kill -HUP $MAINPID
    Restart=on-failure
    RestartSec=3s

    [Install]
    WantedBy=multi-user.target
  • 服务启动命令

    1
    2
    systemctl enable trojan
    systemctl start trojan
 评论