Skip to content
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
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM centos:latest

# 安装依赖
RUN yum install -y \
gcc gcc-c++ \
pcre pcre-devel \
openssl openssl-devel \
zlib zlib-devel git corntabs

# 添加用户
RUN useradd jsproxy -g nobody && su jsproxy

# 添加文件夹
ADD . /home/jsproxy/server

# 安装服务器
RUN bash /home/jsproxy/server/setup-nginx.sh

EXPOSE 8080 8443

# 启动服务
CMD ["/home/jsproxy/openresty/nginx/sbin/nginx","-c","/home/jsproxy/server/nginx.conf","-p","/home/jsproxy/server/nginx","-g","daemon off;"]
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,19 @@ https://zjcqoo.github.io/-----https://www.google.com

虽然依旧简陋,但比之前好。提供了线路切换、预加载的功能。

### 懒人模式

懒人模式提供自动生成CF certificate 并且使用docker进行一键启动服务器

```bash
# 执行命令生成需要的配置文件
bash genConf.sh
# 生成docker镜像
docker build -t jsproxy .
运行镜像
docker run -d -p 8080:8080 -p 8443:8443 jsproxy
```

# License

MIT
2 changes: 1 addition & 1 deletion allowed-sites.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
#
http://localhost 'lo';
https://etherdream.github.io 'gh-eth';
https://zjcqoo.github.io 'gh-qoo';
https://zjcqoo.github.io 'gh-qoo';
29 changes: 29 additions & 0 deletions genConf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# CF 证书配置
echo "请输入CF域名";
read domain;
echo "请输入CF信箱";
read mail;
echo "请输入CF 密钥";
read token;

echo "请输加入入允许访问域名";
read allowedDomain;

curl https://get.acme.sh | sh

cat > ./gen-cert/dnsconf <<EOF
DOMAIN=$domain
DNS_ID=dns_cf
export CF_Key="$token"
export CF_Email="$mail"
EOF
cd ./gen-cert
bash gen.sh
cd ..
# 替换域名
sed -i "s/example.com/$domain/g" nginx.conf
# 添加服务器到白名单
echo "https://$allowedDomain '$allowedDomain';" >> allowed-sites.conf
echo "生成完毕 请使用Docker进行后续工作"
8 changes: 4 additions & 4 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
http {
server {
# server_name example.com;
# ssl_certificate cert/example.com/ecc.cer;
# ssl_certificate_key cert/example.com/ecc.key;
# listen 8443 ssl http2;
server_name example.com;
ssl_certificate cert/example.com/ecc.cer;
ssl_certificate_key cert/example.com/ecc.key;
listen 8443 ssl http2;
listen 8080;
include api.conf;
}
Expand Down