[TOC]
## Nginx
### 反向代理
正向代理:代理的客户端,比如翻墙软件
反向代理:代理的服务器,对外隐藏了服务端的真实的ip和port
```
server{
listen 80;
server_name xxx.com //ip
location / {
root html; //举例
proxy_pass http://ip:port;
index index.html index.htm; //举例
}
}
```
### 负载均衡
```
upstream myserver{
server 208.111.203.11:8801
server 208.111.203.11:8802
}
server{
listen 80;
server_name xxx.com //或者ip
location / {
root html; //举例
proxy_pass http://myserver;// 在这里
index index.html index.htm; //举例
}
}
```
#### 负载均衡方式
>ip_hash
```
upstream myserver{
ip_hash;
server 208.111.203.11:8801;
server 208.111.203.11:8802;
}
```
>weight 权重
```
upstream myserver{
server 208.111.203.11:8801 weight=7;
server 208.111.203.11:8802 weight=3;
}
```
>fair
```
upstream myserver{
server 208.111.203.11:8801;
server 208.111.203.11:8802;
fair;
}
```
### 重定向
#### 访问a页面重定向到b页面
```
server{
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
rewrite /a.html /b.html;
}
```
#### 访问当前nginx,重定向到其他网址
**eg**
访问www.a.com 跳转到 www.b.com
```
server{
listen 80;
server_name www.a.com;
rewrite ^/ http://www.b.com/;
location / {
root html;
index index.html index.htm;
}
```
- Go准备工作
- 依赖管理
- Go基础
- 1、变量和常量
- 2、基本数据类型
- 3、运算符
- 4、流程控制
- 5、数组
- 数组声明和初始化
- 遍历
- 数组是值类型
- 6、切片
- 定义
- slice其他内容
- 7、map
- 8、函数
- 函数基础
- 函数进阶
- 9、指针
- 10、结构体
- 类型别名和自定义类型
- 结构体
- 11、接口
- 12、包
- 13、反射
- 14、并发
- 15、网络编程
- 16、单元测试
- Go常用包
- Context
- time
- strings/strconv
- file
- http
- Go常用第三方包
- Go优化
- Go问题排查
- Go框架
- 基础知识点的思考
- 面试题
- 八股文
- 操作系统
- 整理一份资料
- interface
- array
- slice
- map
- MUTEX
- RWMUTEX
- Channel
- waitGroup
- context
- reflect
- gc
- GMP和CSP
- Select
- Docker
- 基本命令
- dockerfile
- docker-compose
- rpc和grpc
- consul和etcd
- ETCD
- consul
- gin
- 一些小点
- 树
- K8s
- ES
- pprof
- mycat
- nginx
- 整理后的面试题
- 基础
- Map
- Chan
- GC
- GMP
- 并发
- 内存
- 算法
- docker