zjcqoo 6 years ago
parent
commit
fa43373ec2
4 changed files with 48 additions and 62 deletions
  1. 31 56
      README.md
  2. 14 0
      docs/compile.md
  3. 1 1
      release.sh
  4. 2 5
      upload.sh

+ 31 - 56
README.md

@@ -2,77 +2,55 @@
 
 https://zjcqoo.github.io/-----https://www.google.com
 
-(由于访问量较大,目前限制 Referer 只允许从 GitHub 访问)
 
+# 安装
 
-# 一键安装
-
-```sh
-curl https://raw.githubusercontent.com/EtherDream/jsproxy/master/i.sh | sh
+```bash
+curl https://raw.githubusercontent.com/EtherDream/jsproxy/master/i.sh | bash
 ```
 
-(暂时只支持 Linux x64 版本。安装成功后自动开启服务。如果安装失败,尝试手动安装)
+如果安装失败,尝试[源码编译安装](docs/compile.md)。
 
 
-# 手动安装
+# 测试
 
-新建一个 `jsproxy:nobody` 用户,在其主目录安装 nginx
+可通过如下命令,验证代理是否生效
 
 ```bash
-groupadd nobody
-useradd jsproxy -g nobody --create-home
-su - jsproxy
-
-git clone --depth=1 https://github.com/EtherDream/jsproxy.git server
-
-cd server
-./setup-nginx.sh
-```
-
-安装过程若有依赖缺失,可尝试(CentOS 为例):
-
-```bash
-yum install -y \
-	gcc gcc-c++ \
-	pcre pcre-devel \
-	openssl openssl-devel \
-	zlib zlib-devel
+curl http://服务器IP:8080/http \
+  -H '--url: https://git.io/fj85d' \
+  -H 'Origin: http://localhost' 
 ```
 
-> nginx 最终安装在 `/home/jsproxy/openresty` 下,不会和系统已有的冲突
+正常情况下,显示 `ok`。如果无法连接,检查 8080/8443 端口是否添加到防火墙。
 
-启动服务
+其他错误,可尝试查看错误日志:
 
 ```bash
-~/server/run.sh
+cat /home/jsproxy/server/nginx/logs/error.log
 ```
 
-# 本地测试
-
-在浏览器中测试 127.0.0.1:8080 服务是否正常运行:
-
-https://zjcqoo.github.io/#local
 
-![](https://raw.githubusercontent.com/EtherDream/jsproxy-localtest/temp/preview.png)
+# 维护
 
-![](https://raw.githubusercontent.com/EtherDream/jsproxy-localtest/temp/preview2.png)
-
-> 如果一直显示加载中,可尝试修改 `nginx.conf` 中 DNS 配置。(默认为 `1.1.1.1`,有些地区很慢)
-
-注意,**当前项目只提供接口服务**,浏览器端脚本和页面不在本项目。这样做是为了让接口和界面分离,意义参见后续。
+```sh
+# 切换到 jsproxy 用户
+su - jsproxy
 
+# 重启服务
+./run.sh reload
 
-# 远程测试
+# 关闭服务(参数和 nginx -s 相同)
+./run.sh quit
 
-如果服务器没有桌面环境无法使用浏览器,可尝试执行:
+# 启动服务
+./run.sh
 
-```sh
-curl http://服务器IP:8080/http \
-  -H 'Origin: http://localhost' \
-  -H '--url: https://www.baidu.com/'
+# 查看代理日志
+tail server/nginx/logs/proxy.log
 ```
 
-观察返回内容是否正常
+目前暂未实现开机自启动
 
 
 # 部署
@@ -107,18 +85,15 @@ https://myhost.github.io     'my';
 
 # 安全策略
 
-如果不希望代理访问内网,可执行 `setup-ipset.sh`,避免 SSRF 风险。
+如果不希望代理访问内网,可执行 `setup-ipset.sh` 避免 SSRF 风险:
 
-该脚本可禁止 `jsporxy` 用户访问内网(针对 TCP)。nginx 之外的程序也生效,但不影响其他用户。
-
-
-# 服务管理
-
-重启服务:`./run.sh reload`
+```bash
+/home/jsproxy/setup-ipset.sh
+```
 
-关闭服务:`./run.sh quit`
+> 需要 root 权限,依赖 `ipset` 命令
 
-参数和 nginx -s 相同
+该脚本可禁止 `jsporxy` 用户访问内网(针对 TCP)。nginx 之外的程序也生效,但不影响其他用户
 
 
 # 项目特点

+ 14 - 0
docs/compile.md

@@ -0,0 +1,14 @@
+源码编译安装
+
+默认的安装脚本是直接下载已编译的 nginx 程序,目前只提供 Linux x64 系统,其他系统暂未提供,需要从源码编译。
+
+此外,对于没有 root 权限的 Linux 系统,也可通过源码编译,将 nginx 安装在任意位置。(nginx 的程序路径是在编译时指定的,移动文件会导致无法启动,所以只能重新编译)
+
+
+# 安装依赖
+
+ CentOS
+
+```sh
+yum install -y make clang
+```

+ 1 - 1
release.sh

@@ -1 +1 @@
-git archive --format=tar --prefix=server/ master > ../bin/src/server.tar
+git archive --format=tar.gz --prefix=server/ dev > ../bin/server-0.0.2.tar.gz

+ 2 - 5
upload.sh

@@ -3,12 +3,9 @@
 
 HOST=etherdream.com
 NODE=(
-  node-aliyun-hk
+  node-aliyun-hk-0
+  node-aliyun-hk-1
   node-aliyun-sg
-  node-bwh-los
-  node-justhost-moscow
-  node-justhost-novosibirsk
-  node-bungee
 )
 for v in ${NODE[@]}; do
   echo "$v upload ..."