Score:0

Nginx sends garbled bytes for any request

cn flag

I have setup a new site on my Nginx server as a subdomain of another site on the same server. All my other sites still work perfectly fine but this new site simply sends over a bunch of random bytes as a response to any request with any path. There are no headers or anything in the response.

�����������А������ ������� ����������������

see this for my nginx.conf. And this one for my site config. I honestly don't even know where to start with this one. There's nothing in the access log and nothing new in the error log. I have so little information.

I have tried removing the auto-indexing from the site config and putting an index.html in the web root but that's about it. Nothing else really comes to mind.

cn flag
forgot to add links. Sorry! There we are.
djdomi avatar
za flag
please never use pastebin for showing up your config insert them into here directly
cn flag
@djdomi ahhh sorry I thought it would be annoying to have a bunch of config stuff directly in the post. I kept all the comments and stuff so it's pretty long
us flag
The problem in posting critical question stuff on 3rd party sites is that they might disappear at any point, making the question incomplete in the future.
Score:0
us flag

Your configuration has these lines:

server {
    listen 80 http2;
    listen [::]:80 http2;

This means you are telling nginx to serve content using HTTP/2 over port 80. Since browsers don't have information that your server is using HTTP/2 on port 80, they connect using HTTP to the port, and they don't understand the response.

You need to use

server {
    listen 80;
    listen [::]:80;

in your config.

cn flag
How come the browser doesn't know the server is using http/2? How do they normally tell?
us flag
Port 80 is a allocated for HTTP1 protocol. When browser connects to port 80, it always expects HTTP1 based server. Meanwhile, TLS connections are made over port 443, and there is a mechanism (ALPN) to tell what is inside the encrypted connection. Therefore browser can request either HTTP or HTTP/2 from the server during the TLS handshake. This means HTTP/2 is easiest to implement over TLS.
cn flag
Ohh and that's why my other sites worked they had TLS set up already. Alright thank you so much!!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.