# url-forwarder **Repository Path**: cucker/url-forwarder ## Basic Information - **Project Name**: url-forwarder - **Description**: DNS 显性URL、隐性URL 转发器 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-03-20 - **Last Updated**: 2024-07-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # url-forwarder #### 介绍 url-forwarder 是 DNS 显性URL、隐性URL的转发器 #### 软件架构 * **系统架构示意图** ![image](https://gitee.com/cucker/file_store/raw/master/BindUI/%E5%9F%9F%E5%90%8D%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F%E6%9E%B6%E6%9E%84.png) #### 安装教程 1. 把 url-forwarder jar 包、项目./install 目录下的 *.sh 文件复制到转发服务器上, 如目录:/data/software/url-forwarder ```bash mkdir -p /data/software/url-forwarder // 复制 url-forwarder jar 包、项目./install 目录下的 *.sh rz -y ... // 复制 application.yml cp ./src/main/resources/application.yml /data/software/url-forwarder // 目录结构 tree /data/software/url-forwarder/ /data/software/url-forwarder/ ├── install.sh // 安装脚本 ├── update.sh ├── application.yml // 配置文件 ├── url-forwarder-0.0.1-SNAPSHOT.jar // 应用 jar 包 └── url-forwarder.service // 应用的 systemctl 脚本 ``` 2. 安装 url-forwarder.service ```bash cd /data/software/url-forwarder bash ./install.sh ``` 3. 运行 url-forwarder ```bash systemctl start url-forwarder.service ``` * nignx 代理 url-forwarder 新建 /etc/nginx/conf.d/url-forwarder.conf ```bash upstream url_forwarder { server 127.0.0.1:8080 weight=10 max_fails=0; } server { listen 80 default_server; server_name _; charset utf-8; access_log /data/logs/nginx_log/url-forwarder.log main; location / { proxy_pass http://url_forwarder/; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } ``` #### 其他 * 问题1 ```bash $ journalctl -xeu url-forwarder May 06 18:26:29 149acd536b26 java[699]: Caused by: com.mysql.cj.exceptions.UnableToConnectException: Public Key Retrieval is not allowed ... ``` * 解决方法1:连接MySQL的URl中添加不添加 `useSSL=false`,缺省为 `useSSL=true` 修改 application.yml ```yaml spring: # 数据源配置 datasource: # MySQL driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/dns?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&allowMultiQueries=true ``` * 解决方法2:连接MySQL的URl中添加`&allowPublicKeyRetrieval=true` 修改 application.yml ```yaml spring: # 数据源配置 datasource: # MySQL driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/dns?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&allowMultiQueries=true&useSSL=false&allowPublicKeyRetrieval=true ```