以下是nginx.conf配置,根据自己的服务器地址修改即可
1.修改listen监听端口
2.根据您的需求配置跨域几台服务器配置
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
# 你的nginx端口也就是图片中的A
listen 8080;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
# 服务器B的请求地址也就是图片中的B
# pas 的意思是以pas开头的请求转发到B服务器
location /pas {
keepalive_timeout 130;
# B服务器的ip
proxy_pass http://111.111.111.111:9080;
}
# 服务器C的请求地址也就是图片中的C
# bsa 的意思是以bsa开头的请求转发到C服务器
location /bsa {
keepalive_timeout 130;
# C服务器的ip
proxy_pass http://222.222.222.222:9080;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}