dr6673999 2015-12-04 01:02
浏览 50
已采纳

nginx正在提供下载而不是php页面

I upgraded nginx from 1.8.0 to 1.9.7 today and had to change a few lines to get a site working again. Now it works over ssl(443) but not http(80). I had to change fastcgi_params to fastcgi.conf.

When I try a site through cloudflare it says there is no connection with my server. Direct connection I get a downloaded file. Looks like a compressed file thats not getting uncompressed at the browser. This is the headers.

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Cookie:{hidden}
Host:{Hidden}
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36

There are no errors in the browser or on the server. Checked nginx and php-fpm logs.

is there anything else I can try?

Additional INFO: I am using easyengine to power this server but I use the nginx mainline branch.

UPDATE: After purging nginx and reinstalling I can now access all the sites on their standard http(80) port. The one ssl site I have can not be accessed by its https(443) connection. When I do it downloads the php index file. All the other pages work over SSL, just not the index page. Its a wordpress site with pretty URL's. all of the pages are actually the index.php file. But this only happens on the home page. The listen directives for 80 and 443 ssl are in the same virtual host section.

  • 写回答

2条回答 默认 最新

  • dtcyv3985 2015-12-04 17:20
    关注

    The issue has to do with the HTTP2 mode. Removing http2 from the listen line fixes the problem.

    server {
    listen 80 http2;
    listen 443 ssl http2;
    

    Change to:

    server {
    listen 80;
    listen 443 ssl http2;
    

    HTTP2 aparently only works over ssl. Enabling it on the non ssl listen caused the error. Everything works fine and quite accelarated with the http2 on the ssl.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 对于这个问题的代码运行
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败