server {
listen 80;
server_name xy.xxx.com; // 接口的域名
access_log /data/www/logs/nginx/access.log main;
add_header Access-Control-Allow-Origin http://xy.xxx.com; // 允许的域名跨域
add_header Access-Control-Allow-Credentials true;
include nginx_xxx.conf;
location / {
proxy_pass http://192.168.1.212:8136;
include nginx_proxy.conf;
}
error_page 500 502 503 504 /502.html;
location = /50x.html {
root html;
}
}
再简单一点:
server {
listen 80;//监听端口
server_name xy.xxx.com; // 接口的域名、本机IP
location / {
proxy_pass http://192.168.1.212:8136;//代理目标地址
}
}