Archive for July, 2014

Load balancing with Nginx

Posted: July 24, 2014 in Uncategorized

{Fetch,Decode,Execute & Share}

I am using a simple HTTP server written in Python which will runs on the port given by the commandline argument. The servers will act as upstream servers for this test. Three servers are started
on port 8080,8081 and 8081. Each server logs its port number when a request is received. Logs will be written to the log file located at var/log/loadtest.log. So by looking at the log file, we can identify how Nginx distribute incoming requests among the three upstream servers.

Below diagram shows how Nginx and upstream servers are destrubuted.

Load balancing with Nginx Load balancing with Nginx

Below is the code for the simple HTTP server. This is a modification of [1].

Lets start the servers on port 8080, 8081 and 8081.

Check if the servers are running on the secified ports.

*Configure Nginx as a load balancer for above upstream server.

Create a configuration file in /etc/nginx/ with the below…

View original post 440 more words

{Fetch,Decode,Execute & Share}

  • Configure tomcat7 to start on port 80

Open /etc/tomcat7/server.xml and locate to the following lines

Change the port value to 80 as below.

  • Start the tomcat7 as root user

After configuring tomcat7 to start on port 80, if you start the tomcat7 you will get errors in /etc/log/catalina.log file as below

The reason for above error is only root users have the permission to start applications on port 80. So lets configure tomcat to start with rot privileges.
So open the file /etc/init.d/tomcat7 and locate to

Then change the TOMCAT_USER to root as below.

Please note that the location of the tomcat7 file is dependent of the OS.
Debian wheezy – /etc/default/tomcat7 instead of /etc/init.d/tomcat7
Ubuntu 13.04 – /etc/init.d/tomcat7
Ubuntu 14.04 – /etc/default/tomcat7

Those locations were reported by the viewers commented below

  • Restart the tomcat7

If everything is fine, you will get an output similar to

tomcat7 (pid  24215)…

View original post 66 more words