#下载解压trojan
cd /usr/src
wget https://github.com/trojan-gfw/trojan/releases/download/v1.16.0/trojan-1.16.0-linux-amd64.tar.xz
tar xf trojan-1.*
#生成自建证书,复制到trojan目录
cd /root
openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 36500
cp cert.pem key.pem /usr/src/trojan
#常用命令
systemctl start trojan
systemctl stop trojan
systemctl restart trojan
systemctl enable trojan
systemctl disable trojan
systemctl status trojan
#设置自动启动
vim /lib/systemd/system/trojan.service
[Unit]
Description=trojan
Documentation=man:trojan(1) https://trojan-gfw.github.io/trojan/config https://trojan-gfw.github.io/trojan/
After=network.target network-online.target nss-lookup.target mysql.service mariadb.service mysqld.service
[Service]
Type=simple
StandardError=journal
User=root
AmbientCapabilities=CAP_NET_BIND_SERVICE
ExecStart=/usr/src/trojan/trojan /usr/src/trojan/config.json
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=1s
[Install]
WantedBy=multi-user.target
#编辑trojan配置文件
vim /usr/src/trojan/config.json
{
"run_type": "server",
"local_addr": "0.0.0.0",
"local_port": 9622,
"remote_addr": "127.0.0.1",
"remote_port": 80,
"password": [
"l1icznxqwhD&53J^"
],
"log_level": 1,
"ssl": {
"cert": "/usr/src/trojan/cert.pem", //fullchain.cer
"key": "/usr/src/trojan/key.pem", //域名.key
//"sni": "域名",
"key_password": "",
"cipher": "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384",
"cipher_tls13": "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384",
"prefer_server_cipher": true,
"alpn": [
"http/1.1"
],
"alpn_port_override": {
"h2": 81
},
"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": "127.0.0.1",
"server_port": 3306,
"database": "trojan",
"username": "trojan",
"password": "",
"key": "",
"cert": "",
"ca": ""
}
}
centos搭建trojan
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 1 说明 [Centos7搭建DockerRegistry]介绍了DockerRegistry的搭建,但它没有UI...
- CentOS6.4安装 1、使用课程提供的镜像:CentOS-6.4-i386-minimal.iso。2、创建虚...
- 2019-k8s-centos 2019最新k8s集群搭建教程 (centos k8s 搭建)网上全是要么过时的,...
- 前言 前置条件 环境:操作系统为CentOS,已配置免密登录,已配置Java环境变量。 安装说明 服务器: nod...
- 一、 Nginx 介绍 1.1 Nginx 简介 Nginx 是一款自由的、 开源的、 高性能的 HTTP 服务器...