首页 > 系统相关 >nginx配置普通server

nginx配置普通server

时间:2023-01-12 11:35:59浏览次数:42  
标签:http 配置 server nginx api proxy pass location

1 新建conf并添加如下:

server {
listen 2222; #listen、server_name这些正常配置
listen [::]:2222;
server_name localhost;
location ^~ /s/cms/ {
proxy_pass http://cms/; ##反向代理执行定义的upstream名字
}
location /api/gateway/ {
proxy_pass http://api-gateway/;
}

location /api/dev/ {
proxy_pass http://api-dev/;
}

location /api/cms/ {
client_max_body_size 600M;
client_body_buffer_size 600M;
proxy_pass http://api-cms/;
}

location /api/log/ {
proxy_pass http://api-log/;
}

location /api/websocket/ {
proxy_pass http://api-websocket/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}

upstream cms{

# server 192.168.1.10:8010;
server 172.24.187.132:8010;

}

upstream api-gateway{

# server 192.168.1.10:8084;
server 172.24.187.132:8084;

}

 

标签:http,配置,server,nginx,api,proxy,pass,location
From: https://www.cnblogs.com/MUQINGFENG123/p/17045983.html

相关文章