# 5.1 短网址服务器搭建

### 哪些时候需要自己搭建短网址服务器？

* 你的业务常常被ddos、ss等大流量攻击
* 你的业务访问量较高
* 你的业务保密性高
* 希望更稳定
* 其他

{% hint style="info" %}
&#x20;由于系统自带的短网址服务器防御性不高，多人共用可能会导致不稳定现象。因此我们建议任何一个用户都应该搭建自己的短网址服务器。

如果不会搭建，可以联络工作人员，他们很乐意为你完成这个搭建任务！
{% endhint %}

> 如果你没有以上要求，那就直接解析到系统服务器上，[点击查看](https://wechaturl.gitbook.io/wechaturl/server_manage/domain_resolve)

### 以下我们以宝塔bt.cn linux面板为例为你详细介绍安装方法

#### 系统要求:centos 7.\* 64bit  ,内存1G或以上，CPU 1核或以上,带宽1兆或以上。

> 如果网站访问者来自中国大陆：我们建议你租用拥有CN2香港网络服务商。如中国知名的阿里云、百度云、腾讯云,非中国知名的搬瓦工、gigsgigscloud.以上推荐的服务商均有CN2香港网络；
>
> 如果网站访问者来自其他国家：我们建议你租用aws,google,azure等国际大厂云服务器。

1. 安装宝塔面板

```
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
```

&#x20;  2\. 进入宝塔管理中心-->软件商店-->Nginx -->安装

> 你也可以按照宝塔推荐安装。如果你这样做，安装时间会长一些

![](/files/-LzANpagHmQ2sRWWaWNn)

* Nginx安装完成后，宝塔管理中心-->网站-->添加站点

![按照如图填写](/files/-LzAOzjli7JKb0naNwS2)

&#x20;   3\. 回到站点列表，在“添加站点”的右边点击“默认站点”

![将默认站点设置成你之前创建的网站](/files/-LzAPSJimQHnbgtB_fxD)

&#x20;  4.回到站点列表，short.com站点行最右边点击 “设置”，进入后，找到“反向代理”-->“添加反向代理”

![如图配置](/files/-LzAQkUIaJXcIh9Uaq8E)

&#x20;  5\.   回到站点列表，short.com站点行最右边点击 “设置”，进入后，找到“网站目录”-->“写入访问日志”取消打钩

![](/files/-LzARBwhqklHoRgaqW7c)

#### 配置完成,现在我们来检测是否正确

```
使用浏览器访问以下网址
http://yourip/check.txt
如果显示true,则代表成功

#如果是使用CDN加速，切记关闭缓存或者将缓存设置为0秒
#检测短网址是否开启缓存,在访问的url上加上GET参数：check_cache=1
http://yourip_or_shortdomain.com/任意字符串?check_cache=1
```

#### 最后将你的入口域名(短网址域名)解析到这个服务器（A记录）上即可

### 结尾

> 如果你已经掌握了nginx反向代理技术或者apache配置方法，当然你完全可以手动配置


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wechaturl.gitbook.io/wechaturl/server_manage/shortdomain_server_install.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
