Nginx is not responding for android mobile using org.apache.http Post Request


I am newbie to Nginx. I am running my ruby on rails application with
nginx and mongrel cluster. when i send the http POST request from
android mobile native app, i am not able to get the response. but for
GET request i am able to get the response properly.

i have tried following also

  if ($request_method !~ ^(GET|POST|HEAD)$ ) {
     return 444;

still i am not able to get it work done.

What could be the problem?

Note : when i run my application in single port without nginx. i am able
to get the response properly. so i suspect that the problem exist in the
nginx configuration.

Please anybody help me to fix this issue.


Posted at Nginx Forum:,71360,71360#msg-71360

On Mon, 2010-04-05 at 06:23 -0400, Bala wrote:

so i suspect that the problem exist in the nginx configuration.

So maybe you should post your configuration?


Cliff W. Wrote:

So maybe you should post your configuration?

Well the following is my configuration :

Server Configuration

Processor : 2x AMD Quad core 2382 @ 2.70Hz

Ram : 32GB memory

OS : CentOS release 5.3 (Final)

Nginx Version

nginx version: nginx/0.7.65
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-46)
configure arguments: --with-poll_module --with-select_module

Sample Configuration File

user and group to run as

user root;

number of nginx workers

worker_processes 2;

pid of nginx master process

pid /var/run/;

Number of worker connections. 1024 is a good default

events {
worker_connections 4000;
#use poll;
multi_accept on;
accept_mutex on;
accept_mutex_delay 50ms;
epoll_events 1024;

start the http module where we config http access.

http {

pull in mime-types. You can break out your config

into as many include’s as you want to make it cleaner

include /usr/local/nginx/conf/mime.types;

set a default type for the rare situation that

nothing matches from the mimie-type include

default_type application/octet-stream;

charset utf-8;
source_charset utf-8;
clinet_header_buffer_size 40k;
large_clinet_header_buffers 4 30k;

configure log format

log_format main '“Status” $status “Bytes” $bytes_sent “u Addr:”
$upstream_addr “u status” $upstream_status “U Response”

$upstream_response_time “MSec” $msec ';

log_format error '“Status” $status “Bytes” $bytes_sent “u Addr:”
$upstream_addr “u status” $upstream_status “U Response”

$upstream_response_time “MSec” $msec ';

main access log

#access_log /var/log/nginx/nginx_access.log main;
access_log off;

main error log

error_log /var/log/nginx/nginx_error.log error;

no sendfile on OSX

sendfile on;
keepalive_timeout 5;

These are good default values.

tcp_nopush on;
tcp_nodelay on;

output compression saves bandwidth

gzip off;

client_body_timeout 1s;

upstream Sample {


server {

listen 80;

client_max_body_size 100M;


root /home/public;

location ~*

root /home/public;
expires 7d;

location / {
proxy_set_header X-Real-IP $remote_addr;
if ($request_method !~ ^(GET|POST|HEAD) {
return 444;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
#proxy_redirect off;
proxy_max_temp_file_size 0;
proxy_connect_timeout 30;
proxy_pass http://Sample;


Posted at Nginx Forum:,71360,71484#msg-71484

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs