nginx修改配置nginx.config实现跨域请求
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {//跨域请求url
listen 8082;
server_name 10.9.1.179;
default_type 'text/html';
charset utf-8;
location / {
root html;
index getstep.html index.html index.htm;
}
location /api/ {//项目原请求路径,api是项目请求资源根目录
proxy_pass http://10.9.1.179:8071;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}