Welcome! Log In Create A New Profile

Advanced

Re: Duplicated response body with fastcgi

Etienne Robillard
July 14, 2017 08:34AM
How can one debug the upstream FastCGI response from nginx?



Le 2017-07-13 à 10:25, Etienne Robillard a écrit :
> Hi,
> I'm trying to setup a Django app with nginx using fastcgi. Here's my
> config:
>
> # configuration file /etc/nginx/nginx.conf:
> user www-data;
> worker_processes 4;
> pid /run/nginx.pid;
>
> events {
> worker_connections 512;
> multi_accept on;
> use epoll;
> }
>
> http {
>
> ##
> # Basic Settings
> ##
>
> sendfile on;
> tcp_nopush on;
> tcp_nodelay on;
> keepalive_timeout 80;
> types_hash_max_size 2048;
> # server_tokens off;
>
> # server_names_hash_bucket_size 64;
> # server_name_in_redirect off;
>
> include /etc/nginx/mime.types;
> default_type application/octet-stream;
>
> ##
> # SSL Settings
> ##
>
> ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
> ssl_prefer_server_ciphers on;
>
> ##
> # Logging Settings
> ##
>
> access_log /var/log/nginx/access.log;
> error_log /var/log/nginx/error.log;
>
> ##
> # Gzip Settings
> ##
>
> 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/conf.d/development.conf;
> #include /etc/nginx/sites-enabled/*;
> }
>
>
> #mail {
> # # See sample authentication script at:
> # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
> #
> # # auth_http localhost/auth.php;
> # # pop3_capabilities "TOP" "USER";
> # # imap_capabilities "IMAP4rev1" "UIDPLUS";
> #
> # server {
> # listen localhost:110;
> # protocol pop3;
> # proxy on;
> # }
> #
> # server {
> # listen localhost:143;
> # protocol imap;
> # proxy on;
> # }
> #}
>
> # configuration file /etc/nginx/mime.types:
>
> types {
> text/html html htm shtml;
> text/css css;
> text/xml xml;
> image/gif gif;
> image/jpeg jpeg jpg;
> application/javascript js;
> application/atom+xml atom;
> application/rss+xml rss;
>
> text/mathml mml;
> text/plain txt;
> text/vnd.sun.j2me.app-descriptor jad;
> text/vnd.wap.wml wml;
> text/x-component htc;
>
> image/png png;
> image/tiff tif tiff;
> image/vnd.wap.wbmp wbmp;
> image/x-icon ico;
> image/x-jng jng;
> image/x-ms-bmp bmp;
> image/svg+xml svg svgz;
> image/webp webp;
>
> application/font-woff woff;
> application/java-archive jar war ear;
> application/json json;
> application/mac-binhex40 hqx;
> application/msword doc;
> application/pdf pdf;
> application/postscript ps eps ai;
> application/rtf rtf;
> application/vnd.apple.mpegurl m3u8;
> application/vnd.ms-excel xls;
> application/vnd.ms-fontobject eot;
> application/vnd.ms-powerpoint ppt;
> application/vnd.wap.wmlc wmlc;
> application/vnd.google-earth.kml+xml kml;
> application/vnd.google-earth.kmz kmz;
> application/x-7z-compressed 7z;
> application/x-cocoa cco;
> application/x-java-archive-diff jardiff;
> application/x-java-jnlp-file jnlp;
> application/x-makeself run;
> application/x-perl pl pm;
> application/x-pilot prc pdb;
> application/x-rar-compressed rar;
> application/x-redhat-package-manager rpm;
> application/x-sea sea;
> application/x-shockwave-flash swf;
> application/x-stuffit sit;
> application/x-tcl tcl tk;
> application/x-x509-ca-cert der pem crt;
> application/x-xpinstall xpi;
> application/xhtml+xml xhtml;
> application/xspf+xml xspf;
> application/zip zip;
>
> application/octet-stream bin exe dll;
> application/octet-stream deb;
> application/octet-stream dmg;
> application/octet-stream iso img;
> application/octet-stream msi msp msm;
>
> application/vnd.openxmlformats-officedocument.wordprocessingml.document
> docx;
> application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
> application/vnd.openxmlformats-officedocument.presentationml.presentation
> pptx;
>
> audio/midi mid midi kar;
> audio/mpeg mp3;
> audio/ogg ogg;
> audio/x-m4a m4a;
> audio/x-realaudio ra;
>
> video/3gpp 3gpp 3gp;
> video/mp2t ts;
> video/mp4 mp4;
> video/mpeg mpeg mpg;
> video/quicktime mov;
> video/webm webm;
> video/x-flv flv;
> video/x-m4v m4v;
> video/x-mng mng;
> video/x-ms-asf asx asf;
> video/x-ms-wmv wmv;
> video/x-msvideo avi;
> }
>
> # configuration file /etc/nginx/conf.d/development.conf:
> server {
>
> # static medias web server configuration, for development
> # and testing purposes.
>
> listen 80;
> server_name localhost;
> error_log /var/log/nginx/error_log; #debug
> #access_log /var/log/nginx/gthc.org/access.log;
> root /home/erob/www/isotopesoftware.ca;
> #autoindex on;
>
> location / {
> # # host and port to fastcgi server
> fastcgi_pass 127.0.0.1:8808; # 8808=gthc.org; 8801=tm
> include fastcgi_params;
> autoindex on;
> # # rewrite /CamelCase to /wiki/CamelCase
> # rewrite ^/(.*[A-Z][a-z]*)$ /wiki$1 last;
> #etag on;
> #fastcgi_pass_header $http_if_none_match;
> }
>
>
> # debug url rewriting to the error log
> rewrite_log on;
>
> location /media {
> autoindex on;
> gzip on;
> }
>
> location /pub {
> autoindex on;
> gzip on;
> }
>
> location /webalizer {
> autoindex on;
> gzip on;
> #auth_basic "Private Property";
> #auth_basic_user_file /etc/nginx/.htpasswd;
> allow 67.68.76.70;
> deny all;
> }
>
> location /documentation {
> autoindex on;
> gzip on;
> }
>
> location /moin_static184 {
> autoindex on;
> gzip on;
> }
> location /favicon.ico {
> empty_gif;
> }
> location /robots.txt {
> root /home/www/isotopesoftware.ca;
> }
> location /sitemap.xml {
> root /home/www/isotopesoftware.ca;
> }
>
> #location /public_html {
> # root /home/www/;
> # autoindex on;
> #}
> # redirect server error pages to the static page /50x.html
> #error_page 404 /404.html;
> #error_page 403 /403.html;
> #error_page 500 502 503 504 /50x.html;
> #location = /50x.html {
> # root /var/www/nginx-default;
> #}
>
> include conf.d/moinmoin.conf;
> include conf.d/livestore.conf;
> }
>
>
> # configuration file /etc/nginx/fastcgi_params:
> fastcgi_param PATH_INFO $fastcgi_script_name;
> fastcgi_param QUERY_STRING $query_string;
> fastcgi_param REQUEST_METHOD $request_method;
> fastcgi_param CONTENT_TYPE $content_type;
> fastcgi_param CONTENT_LENGTH $content_length;
>
> fastcgi_param SCRIPT_NAME $fastcgi_script_name;
> fastcgi_param REQUEST_URI $request_uri;
> fastcgi_param DOCUMENT_URI $document_uri;
> fastcgi_param DOCUMENT_ROOT $document_root;
> fastcgi_param SERVER_PROTOCOL $server_protocol;
>
> fastcgi_param GATEWAY_INTERFACE CGI/1.1;
> fastcgi_param SERVER_SOFTWARE nginx;
>
> fastcgi_param REMOTE_ADDR $remote_addr;
> fastcgi_param REMOTE_PORT $remote_port;
> #fastcgi_param REMOTE_USER $remote_user;
> fastcgi_param SERVER_ADDR $server_addr;
> fastcgi_param SERVER_PORT $server_port;
> fastcgi_param SERVER_NAME $server_name;
>
>
> #XXX
> #fastcgi_param HTTP_IF_NONE_MATCH $http_if_none_match;
> #fastcgi_param HTTP_IF_MODIFIED_SINCE $http_if_modified_since;
>
>
> # PHP only, required if PHP was built with --enable-force-cgi-redirect
> # fastcgi_param REDIRECT_STATUS 200;
>
> fastcgi_send_timeout 90;
> fastcgi_read_timeout 90;
> fastcgi_connect_timeout 40;
> fastcgi_cache_valid 200 304 10m;
> #fastcgi_buffer_size 128k;
> #fastcgi_buffers 8 128k;
> #fastcgi_busy_buffers_size 256k;
> #fastcgi_temp_file_write_size 256k;
>
>
> # configuration file /etc/nginx/conf.d/moinmoin.conf:
>
>
> location /wiki {
>
>
> if ($uri ~ ^/wiki(.*)?){
> set $wiki_url $1;
> }
> # host and port to fastcgi server
> fastcgi_pass 127.0.0.1:8807; # 8808=gthc.org; 8801=tm;
> 8807=moinmoin
> #include fastcgi_params;
> fastcgi_param GATEWAY_INTERFACE CGI/1.1;
> fastcgi_param SERVER_SOFTWARE nginx;
> fastcgi_param QUERY_STRING $query_string;
> fastcgi_param REQUEST_METHOD $request_method;
> fastcgi_param CONTENT_TYPE $content_type;
> fastcgi_param CONTENT_LENGTH $content_length;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> #fastcgi_param SCRIPT_NAME $fastcgi_script_name;
> fastcgi_param REQUEST_URI $request_uri;
> fastcgi_param DOCUMENT_URI $document_uri;
> fastcgi_param DOCUMENT_ROOT $document_root;
> fastcgi_param SERVER_PROTOCOL $server_protocol;
> fastcgi_param REMOTE_ADDR $remote_addr;
> fastcgi_param REMOTE_PORT $remote_port;
> fastcgi_param SERVER_ADDR $server_addr;
> fastcgi_param SERVER_PORT $server_port;
> fastcgi_param SERVER_NAME $server_name;
> fastcgi_param PATH_INFO $wiki_url;
> fastcgi_param SCRIPT_NAME /wiki;
> }
> #location /moin_static184 {
> # root /home/www/isotopesoftware.ca;
> # autoindex on;
> #}
>
>
>
> # configuration file /etc/nginx/conf.d/livestore.conf:
>
>
> location /store {
>
>
> if ($uri ~ ^/store(.*)?){
> set $store_url $1;
> }
> # host and port to fastcgi server
> fastcgi_pass 127.0.0.1:8809; # 8808=gthc.org; 8801=tm;
> 8807=moinmoin
> #include fastcgi_params;
> fastcgi_param GATEWAY_INTERFACE CGI/1.1;
> fastcgi_param SERVER_SOFTWARE nginx;
> fastcgi_param QUERY_STRING $query_string;
> fastcgi_param REQUEST_METHOD $request_method;
> fastcgi_param CONTENT_TYPE $content_type;
> fastcgi_param CONTENT_LENGTH $content_length;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> #fastcgi_param SCRIPT_NAME $fastcgi_script_name;
> fastcgi_param REQUEST_URI $request_uri;
> fastcgi_param DOCUMENT_URI $document_uri;
> fastcgi_param DOCUMENT_ROOT $document_root;
> fastcgi_param SERVER_PROTOCOL $server_protocol;
> fastcgi_param REMOTE_ADDR $remote_addr;
> fastcgi_param REMOTE_PORT $remote_port;
> fastcgi_param SERVER_ADDR $server_addr;
> fastcgi_param SERVER_PORT $server_port;
> fastcgi_param SERVER_NAME $server_name;
> fastcgi_param PATH_INFO $store_url;
> fastcgi_param SCRIPT_NAME /store;
> }
> location /satchmo_media {
> root /home/www/livestore;
> autoindex on;
> gzip on;
> expires 30d;
> }
>
> The problem is that nginx is duplicating the response body stream for
> the /store location. This issue does not happen in WSGI mode.
>
> Any ideas how to fix?
>
> Thank you in advance,
>
> E
>
>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>

--
Etienne Robillard
tkadm30@yandex.com
http://www.isotopesoftware.ca/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Duplicated response body with fastcgi

Etienne Robillard July 13, 2017 10:26AM

Re: Duplicated response body with fastcgi

Etienne Robillard July 14, 2017 08:34AM

Re: Duplicated response body with fastcgi

Etienne Robillard July 15, 2017 04:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 224
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready