Configure Nginx to Direct HTTP Requests to Universal Messaging
Nginx provides an http block that includes directives for handling web traffic. The http block in turn includes a server block where you specify virtual server configurations.
To configure Nginx to serve http requests to Universal Messaging, add the following code to the nginx.conf file or to a separate conf file that you include in the main Nginx configuration module. If Nginx is running, you must reload it for the changes to take effect.
user nginx;
worker_processes auto;
pid /var/run/nginx.pid;
# Set the number of open file descriptors configuration according to the resource limits of the machine.
worker_rlimit_nofile 25000;
events {
# Set this configuration according to the resource limits of the machine.
worker_connections 20000;
}
http {
# Log settings. You can customize them as required.
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# The server closes idle connections after this timeout.
keepalive_timeout 300s;
# The number of requests that the client can make over a single connection.
keepalive_requests 1000000;
# Required setting because the UM client sends “User-Agent: Mozilla/4.0 (compatible; MSIE 6.0;
# Windows NT 5.0).” The Nginx default value is 'msie6', which causes Nginx to close
# UM client connections.
keepalive_disable none;
server {
listen 80;
server_name proxy_server;
location / {
# Important: Nginx must continuously send data to the Universal Messaging
# client rather than buffering it.
proxy_buffering off;
# Important: Configure proxy HTTP protocol version 1.1 to enable the connection
# keepalive and specify an empty string for the connection header.
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://umhost:port;
# 120 seconds timeout to wait for a response
proxy_read_timeout 120s;
}
}
}
In the provided configuration, the Nginx server listens on port 80 and redirects client requests to the Universal Messaging server URL specified in the proxy_pass directive that is part of the server > location block.
For example, if you specify http://umserver1host:9000 for proxy_pass, when a client is trying to connect to http://nginxhost:80, which is the address of the Nginx server, all requests to this server will be redirected to the Universal Messaging server configured at http://umserver1host:9000.