去官網下載下傳nginx穩定版
如果ajax請求的完整接口為http://192.168.1.545/login;
打開nginx/conf/nginx.conf檔案,修改配置檔案

listen 代表打開的端口,root代表html檔案所在的位置;index 代表跨域檔案的名字
proxy——pass代表請求的接口
html中ajax的url為‘/login’;
location /login代表遇到接口中有/login的接口都替換為proxy——pas中的接口;
配置完畢,在nginx檔案運作start nginx,啟動nginx
通路localhost:8899/html/1111.html
指令重新開機nginx:nginx -s reload
停止nginx: nginx -s stop