Debian/Ubuntu Nginx installation, reverse proxy, and basic load balancing configurations, using tung.pdf
Source code Installation
Go to the Nginx official website to download the latest stable version, here is the nginx-1.6.3 version.
After the download is complete, decompress the package and enter the directory for execution:
./configure
If your machine is not installedPCER
Library,zlib
Library.
sudo apt-get install libpcre3-dev zlibc zlib-bin
Then execute:
sudo makesudo make install
Nginx is installed on/usr/local/nginx
Directory.
Basic configuration of reverse proxy
The default configuration file used by nginx is/user/local/nginx/conf/nginx.conf
. If the upstream Server is a JBoss cluster, you canhttp
Block to configure as follows:
upstream jboss { server localhost:8080; server xx.xx.xx.xx:port server server-domain-name}
server
Block to configure as follows:
location / { proxy_pass http://jboss;}
Simple ip_hash Configuration
In most cases, if nginx is used as the load-based machine, we all want to deliver the same ip address to the game server on the same server every time. The configuration is as follows:
upstream jboss { ip_hash; server localhost:8080; server xx.xx.xx.xx:port; server server-domain-name}
In this case, if a JBoss fails to be used, you cannot directly Delete the JBoss address from the preceding configuration. Instead, you must:
upstream jboss { ip_hash; server localhost:8080; server xx.xx.xx.xx:port down; server server-domain-name;}
Then execute
/usr/local/nginx -s reload
Reload the configuration file.