I recently updated nginx to 1.9.7 which comes with http2 support.
When enabling http2 in one of my vhosts, every page that nginx should be serving from that vhost is instead downloaded. I tested this on the latest version of Chrome, Safari, and Chrome for Android. All had the same result of downloading and saving the page name I navigated to, even if the page didn't actually exist on the server. The page saved on the computer never contained the actual contents of it on the server. It was some weird file that contained the same, weird 1kb string). I tried testing different extensions, to make sure it wasn't an issue with php-fpm, every extension downloaded.
vhost config:
server {
listen <ip>:80 http2;
server_name testsite.dev;
index index.php index.html index.htm;
root /home/sites/test/www;
access_log /var/log/nginx/sites/testsite-access_log;
error_log /var/log/nginx/sites/testsite-error_log;
# location / {
# try_files $uri $uri/ /index.php;
# }
location = /favicon.ico {
access_log off;
log_not_found off;
}
gzip off;
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm/testsite.socket;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param open_basedir "/home/sites:/tmp:/usr/share/pear:/var/lib/php/session/";
}
}
If I remove the http2
from the listen
directive, the site works 100% as expected and serves files normally.
Any insight on why this is happening? Searching google only seems to yield results about .php files being downloading (caused by a mis-configured php-fpm).
Edit: The file that gets downloaded always has this:
When opened in TextEdit:
ġˇˇˇˇˇˇ
When opened in Sublime Text 3:
0000 1204 0000 0000 0000 0300 0000 8000
047f ffff ff00 0500 ffff ff00 0004 0800
0000 0000 7fff 0000 0000 0807 0000 0000
0000 0000 0000 0000 01