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

force http -> https redirect #24

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
troooojan
本页面为 atrandys 的 trojan 一键脚本之 fork 备份。顺便修复了 atrandys 原版脚本中伪装站没有 SSL 跳转(即访问伪装站不显示小锁)的问题。
## 用法
```sh
bash <(curl -sL https://raw.githubusercontent.com/phlinhng/trojan/master/trojan_mult.sh)
```
18 changes: 12 additions & 6 deletions trojan_mult.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,17 @@ http {
client_max_body_size 20m;
#gzip on;
server {
listen 80;
listen 127.0.0.1:80;
server_name $your_domain;
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
server {
listen 0.0.0.0:80;
listen [::]:80;
server_name _;
return 301 https://\$host\$request_uri;
}
}
EOF
#设置伪装站
Expand All @@ -85,8 +91,8 @@ EOF
fi
mkdir /usr/src/trojan-cert /usr/src/trojan-temp
curl https://get.acme.sh | sh
~/.acme.sh/acme.sh --issue -d $your_domain --standalone
if test -s /root/.acme.sh/$your_domain/fullchain.cer; then
~/.acme.sh/acme.sh --issue -d $your_domain --standalone --keylength ec-256
if test -s /root/.acme.sh/${your_domain}_ecc/fullchain.cer; then
systemctl start nginx
cd /usr/src
#wget https://github.com/trojan-gfw/trojan/releases/download/v1.13.0/trojan-1.13.0-linux-amd64.tar.xz
Expand Down Expand Up @@ -206,7 +212,7 @@ EOF
chmod +x ${systempwd}trojan.service
systemctl enable trojan.service
cd /root
~/.acme.sh/acme.sh --installcert -d $your_domain \
~/.acme.sh/acme.sh --installcert --ecc -d $your_domain \
--key-file /usr/src/trojan-cert/private.key \
--fullchain-file /usr/src/trojan-cert/fullchain.cer \
--reloadcmd "systemctl restart trojan"
Expand Down Expand Up @@ -358,8 +364,8 @@ read your_domain
real_addr=`ping ${your_domain} -c 1 | sed '1{s/[^(]*(//;s/).*//;q}'`
local_addr=`curl ipv4.icanhazip.com`
if [ $real_addr == $local_addr ] ; then
~/.acme.sh/acme.sh --issue -d $your_domain --standalone
~/.acme.sh/acme.sh --installcert -d $your_domain \
~/.acme.sh/acme.sh --issue -d $your_domain --standalone --keylength ec-256
~/.acme.sh/acme.sh --installcert --ecc -d $your_domain \
--key-file /usr/src/trojan-cert/private.key \
--fullchain-file /usr/src/trojan-cert/fullchain.cer \
--reloadcmd "systemctl restart trojan"
Expand Down