Access API:
In the micro-channel applet, is not accessible, you may be used https://douban.uieee.com instead https://api.douban.com
Nginx installation:
- 安装Nginx:http://nginx.org/en/download.html
- unzip files:
- Start Nginx: cmd to open a command window, enter the command Start nginx ; do not double-click to run, so bad
- Check if successful: open the browser, type HTTP: // localhost: 80 ; this will be successful
Set:
Enter the conf directory, open the file nginx.conf . nginx agent, and change requests Referer and User-Agent header information
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /v2/movie/ {
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/movie/;
}
#error_page 404 /404.html;
//...........
}
- When you modify the nginx configuration file nginx.conf, do not need to shut down after the restart nginx nginx, just need to execute the command nginx -s reload to make the changes take effect
- Enter the command nginx nginx -s stop (quick stop nginx) or nginx -s quit (complete stop and orderly nginx)
Run the command nginx -s reload save
use:
After configuring, watercress api request url should change the http: // localhost / v2 / movie
/ top250 is api.douban.com on the basis of the original request of watercress API change for your own domain name.
Nginx报错:[error] CreateFile() "E:\nginx\nginx-1.9.3/logs/nginx.pid" failed
Solution:
Create a file using the command /logs/nginx.pid: nginx -c conf / nginx.conf