8
8
891099838382015-09-25 23:31:43
Nginx
89109983838, 2015-09-25 23:31:43

Nginx problem with POST requests?

There is a site on a bunch of nginx + php-fpm (without Apache)
php script does not receive data from a POST request!
Disabling gzip in nginx settings solved the problem with POST data!
The question is, how is it solved? so that gzip is enabled and POST requests are sent correctly!??
Or how to exclude a specific request from gzip processing (www.site.ru/form.php)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2015-09-26
@sim3x

post request is included in nginx
gzip for outgoing traffic
look for the problem in nginx logs and your script

8
89109983838, 2015-09-26
@89109983838

it was like this:
(by commenting out "gzip off;" post data began to be transferred .... did nothing else!)

user www;
worker_processes 4;
pid /run/nginx.pid;

events {
  worker_connections 512;
  # multi_accept on;
}

http {
  
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 65;
  types_hash_max_size 2048;
  server_tokens off;

  #client_body_buffer_size 128k;
  #client_max_body_size 500m;
  
  server_names_hash_bucket_size 64;
  # server_name_in_redirect off;

  include /etc/nginx/mime.types;
  default_type application/octet-stream;

  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log;

  gzip off;
  gzip_disable "msie6";

  # gzip_vary on;
  # gzip_proxied any;
  # gzip_comp_level 6;
  # gzip_buffers 16 8k;
  # gzip_http_version 1.1;
  # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
  ##
  # Virtual Host Configs
  ##
  include /etc/nginx/sites-enabled/*;
}

and virtual nost
server {
  listen        80;
  server_name   сайт.ru;
  server_tokens off;
  client_body_buffer_size 128k;
  charset utf8;
  client_max_body_size 500m;
  
  root /var/www/web/сайт.ru;
  index index.php;
  location ~*  .(jpg|jpeg|png|gif|ico|css|js)$ { expires 365d; }
  
  location /admin { index index.php; }
  location / { try_files $uri @opencart; }
  location @opencart { rewrite ^/(.+)$ /index.php?_route_=$1 last; }
  
  rewrite ^/sitemap.xml$ /index.php?route=feed/google_sitemap;
    
  location  ~ \.php$ {  
  fastcgi_pass 127.0.0.1:9001;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include fastcgi_params;
  }
  
  
  location ~ /\.ht {
    deny  all;
  }
}

the module is the simplest "quick order" pop-up window with a request for the name and body of the client - sends java data, receives php and saves it to the database, but with gzip enabled, this does not work ..... !

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question