nginx is serving a download instead of php page

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.

Answers


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.


You need to edit /etc/nginx/sites-enabled/default and add this code in default file to execute php files on Nginx Server

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /usr/share/nginx/html;
index index.php index.html index.htm;

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

}

If you would like more on this please refer below link : click here


Need Your Help

Excel - How to add up values with a specific number criteria

excel function formula

Im currently trying to add up moneyvalue and taxvalue seperated from each other in 3 different categorys.