title: nginx/uwsgi don't serve any request
body: <p>I have nginx, uwsgi, django stack.  There use to be an https serving from the nginx but I'm trying to disable it.</p>
  
  <p>this is my nginx configuration files:</p>
  
  <p>nginx.conf:</p>
  
  <pre><code>events {
  worker_connections 768;
  # multi_accept on;
  }
  
  http {
  
  proxy_buffer_size 128k;
  proxy_buffers 4 256k;
  proxy_busy_buffers_size 256k;
  
  ##
  # Basic Settings
  ##
  
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 65;
  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;
  
  ##
  # Logging Settings
  ##
  
  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log;
  
  ##
  # Gzip Settings
  ##
  
  gzip on;
  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/x-javascript text/xml application/xml application/xml+rss text/javascript;
  
  ##
  # nginx-naxsi config
  ##
  # Uncomment it if you installed nginx-naxsi
  ##
  
  #include /etc/nginx/naxsi_core.rules;
  
  ##
  # nginx-passenger config
  ##
  # Uncomment it if you installed nginx-passenger
  ##
  
  #passenger_root /usr;
  #passenger_ruby /usr/bin/ruby;
  
  ##
  # Virtual Host Configs
  ##
  
  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;
  }
  </code></pre>
  
  <p>site-available/mysite.com:</p>
  
  <pre><code>upstream django {
  server 127.0.0.1:44000;
  }
  
  server {
  listen          80 default;
  server_name     www.mysite.com mysite.com;
  
  
  charset         utf-8;
  access_log      /var/log/nginx/mysite_access.log;
  error_log       /var/log/nginx/mysite_error.log;
  
  location /static/ {
      root   /opt/myapp/myapp/;
      index  index.html index.htm;
  }
  
  location / {
    uwsgi_pass  django;
    include     uwsgi_params;
  }
  }
  </code></pre>
  
  <p>When I run it with uwsgi i get this error:</p>
  
  <pre><code>django.core.exceptions.SuspiciousOperation: Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): www.mysite.com
  [pid: 12865|app: 0|req: 1/2] 84.94.36.146 () {36 vars in 571 bytes} [Mon May 26 07:12:55 2014] GET /favicon.ico =&gt; generated 0 bytes in 457 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
  </code></pre>
  
  <p>I put 'www.mysite.com' on my ALLOWED_HOSTS section in settings.py and it didn't help.
  these are the lines I added in settings.py:</p>
  
  <pre><code>ALLOWED_HOSTS = [
  '.mysite.com', # Allow domain and subdomains
  '.mysite.com.', # Also allow FQDN and subdomains
  ]
  </code></pre>
  
  <p>When I run it with runserver i get this error:</p>
  
  <pre><code>[26/May/2014 06:53:09] code 400, message Bad request syntax ('\x00;\x02\x00\x0c\x00QUERY_STRING\x00\x00\x0e\x00REQUEST_METHOD\x03\x00GET\x0c\x00CONTENT_TYPE\x00\x00\x0e\x00CONTENT_LENGTH\x00\x00\x0b\x00REQUEST_URI\x0c\x00/favicon.ico\t\x00PATH_INFO\x0c\x00/favicon.ico\r\x00DOCUMENT_ROOT\x0f\x00/etc/nginx/html\x0f\x00SERVER_PROTOCOL\x08\x00HTTP/1.1\x0b\x00REMOTE_ADDR\x0c\x0084.94.36.146\x0b\x00REMOTE_PORT\x05\x0051792\x0b\x00SERVER_PORT\x02\x0080\x0b\x00SERVER_NAME\x10\x00www.mysite.com\t\x00HTTP_HOST\x10\x00www.mysite.com\x0f\x00HTTP_CONNECTION')
  [26/May/2014 06:53:09] ";
                           QUERY_STRINGREQUEST_METHODGET
                                                        CONTENT_TYPECONTENT_LENGTH
                                                                                  REQUEST_URI
                                                                                             /favicon.ico PATH_INFO
  DOCUMENT_ROOT/etc/nginx/htmlSERVER_PROTOCOHTTP/1.1                                                               /favicon.ico
                                                    REMOTE_ADDR
                                                               84.94.36.146
                                                                           REMOTE_PORT51792
                                                                                           SERVER_PORT80
                                                                                                        SERVER_NAMEwww.mysite.com HTTP_HOSTwww.mysite.comHTTP_CONNECTION" 400 -
  </code></pre>
  
  <p>I read that this error may be caused by HTTPS request, but it doesn't seem to me that I redirect HTTP requests to HTTPS anywhere, cause I deleted all those configurations.</p>
  
  <p>any ideas?</p>
  
  <p>Thanks</p>