nginx配置普通server
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;
}