## 1. 下载Nginx
[下载nginx](http://nginx.org/en/download.html)
[参考](https://www.jianshu.com/p/b08c5e30cc73)
[参考](https://xinwenke.top/douban403/)
## 2. 打开解压文件下的 `/conf/nginx.conf` 修改`server{}`
```
location /v2/ {
proxy_store off;
proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Referer 'no-referrer-when-downgrade';
proxy_set_header User-Agent 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36';
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
proxy_pass https://api.douban.com/v2/;
}
```
## 3. 更改配置后保存,在nginx.exe 文件夹下打开命令窗口,输入start nginx,启动后每次修改配置,使用nginx -s reload 重启
### 3.1. 在命令行中进入nginx
![](https://box.kancloud.cn/732a82c15fd7b37375aad383801e069a_550x213.PNG)
```
start nginx : 启动nginx
nginx -s reload :修改配置后重新加载生效
```
## 4.使用
参考链接
node.js 和 小程序都有
### 小程序
![](https://box.kancloud.cn/7183eefdcfe7bbfedc0c318b15beebc3_671x290.PNG)
>请求头要改
```
wx.request({
url: 'http://localhost/v2/movie/in_theaters',
// url: 'http://localhost',
method: 'GET',
header: { 'content-type': 'application/xml' },
success: function (res) {
console.log(res)
}
})
```
## 5.关闭nginx:
> nginx -s stop :快速停止nginx
> nginx -s quit :完整有序的停止nginx