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

Hi,

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.

Regards,
Bala.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,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

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
–with-rtsig_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/nginx.pid;

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 127.0.0.1:9000;
server 127.0.0.1:9001;
server 127.0.0.1:9002;
server 127.0.0.1:9003;
server 127.0.0.1:9004;
}

server {

listen 80;

client_max_body_size 100M;

server_name www.sample.com;

root /home/public;

location ~*

^.+.(jpg|jpeg|JPG|JPEG|GIF|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$
{
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;
break;
proxy_pass http://Sample;
}

Regards,
Bala.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,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