Nginx + php7.1-fpm - connection using Firefox returns php file instead of result of its execution Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionnginx php-fpm index.php doesn't loadNginx loadbalancing between PHP-FPM and ApacheNGINX + PHP-FPM Permission deniedphpmyadmin blank page after login using nginx / php-fpmNginX + PHP-FPM displays blank php pagesNginx + PHP-FPM serving .php files as downloadsSELinux is preventing NGINX from writing via PHP-FPMFedora - Nginx PHP-FPM - constantly changing FPM Socket to rootNginx version agnostic php-fpm configurationNginx running php-fpm and php process
Why do people hide their license plates in the EU?
Error "illegal generic type for instanceof" when using local classes
Why aren't air breathing engines used as small first stages
Should I use a zero-interest credit card for a large one-time purchase?
What exactly is a "Meth" in Altered Carbon?
How does debian/ubuntu knows a package has a updated version
Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?
List *all* the tuples!
String `!23` is replaced with `docker` in command line
How do pianists reach extremely loud dynamics?
Can I cast Passwall to drop an enemy into a 20-foot pit?
ListPlot join points by nearest neighbor rather than order
2001: A Space Odyssey's use of the song "Daisy Bell" (Bicycle Built for Two); life imitates art or vice-versa?
Denied boarding although I have proper visa and documentation. To whom should I make a complaint?
What is Arya's weapon design?
Why am I getting the error "non-boolean type specified in a context where a condition is expected" for this request?
Check which numbers satisfy the condition [A*B*C = A! + B! + C!]
Sci-Fi book where patients in a coma ward all live in a subconscious world linked together
Why was the term "discrete" used in discrete logarithm?
Why is "Consequences inflicted." not a sentence?
Why are there no cargo aircraft with "flying wing" design?
Is the Standard Deduction better than Itemized when both are the same amount?
How can I make names more distinctive without making them longer?
Why did the Falcon Heavy center core fall off the ASDS OCISLY barge?
Nginx + php7.1-fpm - connection using Firefox returns php file instead of result of its execution
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionnginx php-fpm index.php doesn't loadNginx loadbalancing between PHP-FPM and ApacheNGINX + PHP-FPM Permission deniedphpmyadmin blank page after login using nginx / php-fpmNginX + PHP-FPM displays blank php pagesNginx + PHP-FPM serving .php files as downloadsSELinux is preventing NGINX from writing via PHP-FPMFedora - Nginx PHP-FPM - constantly changing FPM Socket to rootNginx version agnostic php-fpm configurationNginx running php-fpm and php process
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have nginx (1.10.3-1+deb9u2) on Debian 9.6. I have installed php7.1-fpm from external repository (sury.org). I have simple php file executing phpinfo()
function (and nothing more), simply to see if everything works. Now for the funny part. I have it on embedded device with "normal" ethernet interface - if I connect from my PC using this interface I got expected results. But when I connect via USB, so that there is RNDIS-like (or RNDIS, I'm not sure) network interface created, things do not work as expected, that is if I connect using Firefox, I see a dialog asking me where I want to save file - which is exactly the file that should be executed by nginx + fpm combo. But when I connect using Chrome, I get expected result, so standard phpinfo()-generated page.
I believe that configuration is absolutely standard Nginx stuff. Does anyone has any idea how could that happen? If behavior were different depending on the interface that I connect on, it would be pretty obvious information that for some reason Nginx refuses to execute my request using php module. But it depends on the browser that I use and this is bewildering to be honest.
I checked how connections are made in both Fireox and Chrome using developer tools and it seems that they are basically identical, in addition there are no redirections, so that's not it. I haven't tried wget/curl yet and I can't do it now, but no matter what the result will be this is still inacceptable.
Any ideas? No matter how wild they are?
EDIT (configuration):
I've been able to confirm nginx configuration. It is as follows:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events
worker_connections 768;
http
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
load_module modules/ngx_http_auth_pam_module.so;
load_module modules/ngx_http_dav_ext_module.so;
load_module modules/ngx_http_echo_module.so;
load_module modules/ngx_http_geoip_module.so;
load_module modules/ngx_http_image_filter_module.so;
load_module modules/ngx_http_subs_filter_module.so;
load_module modules/ngx_http_upstream_fair_module.so;
load_module modules/ngx_http_xslt_filter_module.so;
load_module modules/ngx_mail_module.so;
load_module modules/ngx_stream_module.so;
types
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/svg+xml svg svgz;
image/webp webp;
application/font-woff woff;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.wap.wmlc wmlc;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
server
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html index.php;
server_name beaglebone;
location /
try_files $uri $uri/ =404;
location ~ .php$
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
location ~ ^/.*.html$
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_split_path_info ^(.+.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_split_path_info ^(.+.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REDIRECT_STATUS 200;
I thought that maybe there are two server blocks, but as you can see there is only one. What is strange is that when I connect using Firefox and nginx (?) serves file instead of executing it, there is nothing in /var/log/nginx/access.log.
php firefox nginx chrome
add a comment |
I have nginx (1.10.3-1+deb9u2) on Debian 9.6. I have installed php7.1-fpm from external repository (sury.org). I have simple php file executing phpinfo()
function (and nothing more), simply to see if everything works. Now for the funny part. I have it on embedded device with "normal" ethernet interface - if I connect from my PC using this interface I got expected results. But when I connect via USB, so that there is RNDIS-like (or RNDIS, I'm not sure) network interface created, things do not work as expected, that is if I connect using Firefox, I see a dialog asking me where I want to save file - which is exactly the file that should be executed by nginx + fpm combo. But when I connect using Chrome, I get expected result, so standard phpinfo()-generated page.
I believe that configuration is absolutely standard Nginx stuff. Does anyone has any idea how could that happen? If behavior were different depending on the interface that I connect on, it would be pretty obvious information that for some reason Nginx refuses to execute my request using php module. But it depends on the browser that I use and this is bewildering to be honest.
I checked how connections are made in both Fireox and Chrome using developer tools and it seems that they are basically identical, in addition there are no redirections, so that's not it. I haven't tried wget/curl yet and I can't do it now, but no matter what the result will be this is still inacceptable.
Any ideas? No matter how wild they are?
EDIT (configuration):
I've been able to confirm nginx configuration. It is as follows:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events
worker_connections 768;
http
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
load_module modules/ngx_http_auth_pam_module.so;
load_module modules/ngx_http_dav_ext_module.so;
load_module modules/ngx_http_echo_module.so;
load_module modules/ngx_http_geoip_module.so;
load_module modules/ngx_http_image_filter_module.so;
load_module modules/ngx_http_subs_filter_module.so;
load_module modules/ngx_http_upstream_fair_module.so;
load_module modules/ngx_http_xslt_filter_module.so;
load_module modules/ngx_mail_module.so;
load_module modules/ngx_stream_module.so;
types
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/svg+xml svg svgz;
image/webp webp;
application/font-woff woff;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.wap.wmlc wmlc;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
server
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html index.php;
server_name beaglebone;
location /
try_files $uri $uri/ =404;
location ~ .php$
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
location ~ ^/.*.html$
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_split_path_info ^(.+.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_split_path_info ^(.+.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REDIRECT_STATUS 200;
I thought that maybe there are two server blocks, but as you can see there is only one. What is strange is that when I connect using Firefox and nginx (?) serves file instead of executing it, there is nothing in /var/log/nginx/access.log.
php firefox nginx chrome
How manyserver
blocks does your configuration have? Where is the PHP file located - is it the same as the default Nginx root?
– Richard Smith
Apr 12 at 17:55
From memory - nginx root is /var/www/html and this is where PHP file is located. There were no extensive changes from default nginx configuration, so I believe that there is only oneserver
block block. And nginx listens on 0.0.0.0:80 (or its equivalent). I thought for a moment that difference might be between IPv4 and IPv6, but I explicitly use IPv4 in the browser (http://192.168.7.2/info.php
to be precise.)
– Jędrzej Dudkiewicz
Apr 12 at 18:03
You can confirm the full configuration withnginx -T
(uppercaseT
). My guess is that there is a default server block which will download files form the default document root.
– Richard Smith
Apr 12 at 18:10
Thanks for information. I've attached result ofnginx -T
but there is only oneserver
block. And please note, that with identical configuration and identical URL I get different results on Chrome and Firefox. Firefox tries to download file, Chrome displays expected result.
– Jędrzej Dudkiewicz
yesterday
add a comment |
I have nginx (1.10.3-1+deb9u2) on Debian 9.6. I have installed php7.1-fpm from external repository (sury.org). I have simple php file executing phpinfo()
function (and nothing more), simply to see if everything works. Now for the funny part. I have it on embedded device with "normal" ethernet interface - if I connect from my PC using this interface I got expected results. But when I connect via USB, so that there is RNDIS-like (or RNDIS, I'm not sure) network interface created, things do not work as expected, that is if I connect using Firefox, I see a dialog asking me where I want to save file - which is exactly the file that should be executed by nginx + fpm combo. But when I connect using Chrome, I get expected result, so standard phpinfo()-generated page.
I believe that configuration is absolutely standard Nginx stuff. Does anyone has any idea how could that happen? If behavior were different depending on the interface that I connect on, it would be pretty obvious information that for some reason Nginx refuses to execute my request using php module. But it depends on the browser that I use and this is bewildering to be honest.
I checked how connections are made in both Fireox and Chrome using developer tools and it seems that they are basically identical, in addition there are no redirections, so that's not it. I haven't tried wget/curl yet and I can't do it now, but no matter what the result will be this is still inacceptable.
Any ideas? No matter how wild they are?
EDIT (configuration):
I've been able to confirm nginx configuration. It is as follows:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events
worker_connections 768;
http
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
load_module modules/ngx_http_auth_pam_module.so;
load_module modules/ngx_http_dav_ext_module.so;
load_module modules/ngx_http_echo_module.so;
load_module modules/ngx_http_geoip_module.so;
load_module modules/ngx_http_image_filter_module.so;
load_module modules/ngx_http_subs_filter_module.so;
load_module modules/ngx_http_upstream_fair_module.so;
load_module modules/ngx_http_xslt_filter_module.so;
load_module modules/ngx_mail_module.so;
load_module modules/ngx_stream_module.so;
types
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/svg+xml svg svgz;
image/webp webp;
application/font-woff woff;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.wap.wmlc wmlc;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
server
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html index.php;
server_name beaglebone;
location /
try_files $uri $uri/ =404;
location ~ .php$
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
location ~ ^/.*.html$
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_split_path_info ^(.+.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_split_path_info ^(.+.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REDIRECT_STATUS 200;
I thought that maybe there are two server blocks, but as you can see there is only one. What is strange is that when I connect using Firefox and nginx (?) serves file instead of executing it, there is nothing in /var/log/nginx/access.log.
php firefox nginx chrome
I have nginx (1.10.3-1+deb9u2) on Debian 9.6. I have installed php7.1-fpm from external repository (sury.org). I have simple php file executing phpinfo()
function (and nothing more), simply to see if everything works. Now for the funny part. I have it on embedded device with "normal" ethernet interface - if I connect from my PC using this interface I got expected results. But when I connect via USB, so that there is RNDIS-like (or RNDIS, I'm not sure) network interface created, things do not work as expected, that is if I connect using Firefox, I see a dialog asking me where I want to save file - which is exactly the file that should be executed by nginx + fpm combo. But when I connect using Chrome, I get expected result, so standard phpinfo()-generated page.
I believe that configuration is absolutely standard Nginx stuff. Does anyone has any idea how could that happen? If behavior were different depending on the interface that I connect on, it would be pretty obvious information that for some reason Nginx refuses to execute my request using php module. But it depends on the browser that I use and this is bewildering to be honest.
I checked how connections are made in both Fireox and Chrome using developer tools and it seems that they are basically identical, in addition there are no redirections, so that's not it. I haven't tried wget/curl yet and I can't do it now, but no matter what the result will be this is still inacceptable.
Any ideas? No matter how wild they are?
EDIT (configuration):
I've been able to confirm nginx configuration. It is as follows:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events
worker_connections 768;
http
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
load_module modules/ngx_http_auth_pam_module.so;
load_module modules/ngx_http_dav_ext_module.so;
load_module modules/ngx_http_echo_module.so;
load_module modules/ngx_http_geoip_module.so;
load_module modules/ngx_http_image_filter_module.so;
load_module modules/ngx_http_subs_filter_module.so;
load_module modules/ngx_http_upstream_fair_module.so;
load_module modules/ngx_http_xslt_filter_module.so;
load_module modules/ngx_mail_module.so;
load_module modules/ngx_stream_module.so;
types
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/svg+xml svg svgz;
image/webp webp;
application/font-woff woff;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.wap.wmlc wmlc;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
server
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html index.php;
server_name beaglebone;
location /
try_files $uri $uri/ =404;
location ~ .php$
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
location ~ ^/.*.html$
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_split_path_info ^(.+.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_split_path_info ^(.+.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REDIRECT_STATUS 200;
I thought that maybe there are two server blocks, but as you can see there is only one. What is strange is that when I connect using Firefox and nginx (?) serves file instead of executing it, there is nothing in /var/log/nginx/access.log.
php firefox nginx chrome
php firefox nginx chrome
edited yesterday
Jędrzej Dudkiewicz
asked Apr 12 at 17:16
Jędrzej DudkiewiczJędrzej Dudkiewicz
1011
1011
How manyserver
blocks does your configuration have? Where is the PHP file located - is it the same as the default Nginx root?
– Richard Smith
Apr 12 at 17:55
From memory - nginx root is /var/www/html and this is where PHP file is located. There were no extensive changes from default nginx configuration, so I believe that there is only oneserver
block block. And nginx listens on 0.0.0.0:80 (or its equivalent). I thought for a moment that difference might be between IPv4 and IPv6, but I explicitly use IPv4 in the browser (http://192.168.7.2/info.php
to be precise.)
– Jędrzej Dudkiewicz
Apr 12 at 18:03
You can confirm the full configuration withnginx -T
(uppercaseT
). My guess is that there is a default server block which will download files form the default document root.
– Richard Smith
Apr 12 at 18:10
Thanks for information. I've attached result ofnginx -T
but there is only oneserver
block. And please note, that with identical configuration and identical URL I get different results on Chrome and Firefox. Firefox tries to download file, Chrome displays expected result.
– Jędrzej Dudkiewicz
yesterday
add a comment |
How manyserver
blocks does your configuration have? Where is the PHP file located - is it the same as the default Nginx root?
– Richard Smith
Apr 12 at 17:55
From memory - nginx root is /var/www/html and this is where PHP file is located. There were no extensive changes from default nginx configuration, so I believe that there is only oneserver
block block. And nginx listens on 0.0.0.0:80 (or its equivalent). I thought for a moment that difference might be between IPv4 and IPv6, but I explicitly use IPv4 in the browser (http://192.168.7.2/info.php
to be precise.)
– Jędrzej Dudkiewicz
Apr 12 at 18:03
You can confirm the full configuration withnginx -T
(uppercaseT
). My guess is that there is a default server block which will download files form the default document root.
– Richard Smith
Apr 12 at 18:10
Thanks for information. I've attached result ofnginx -T
but there is only oneserver
block. And please note, that with identical configuration and identical URL I get different results on Chrome and Firefox. Firefox tries to download file, Chrome displays expected result.
– Jędrzej Dudkiewicz
yesterday
How many
server
blocks does your configuration have? Where is the PHP file located - is it the same as the default Nginx root?– Richard Smith
Apr 12 at 17:55
How many
server
blocks does your configuration have? Where is the PHP file located - is it the same as the default Nginx root?– Richard Smith
Apr 12 at 17:55
From memory - nginx root is /var/www/html and this is where PHP file is located. There were no extensive changes from default nginx configuration, so I believe that there is only one
server
block block. And nginx listens on 0.0.0.0:80 (or its equivalent). I thought for a moment that difference might be between IPv4 and IPv6, but I explicitly use IPv4 in the browser (http://192.168.7.2/info.php
to be precise.)– Jędrzej Dudkiewicz
Apr 12 at 18:03
From memory - nginx root is /var/www/html and this is where PHP file is located. There were no extensive changes from default nginx configuration, so I believe that there is only one
server
block block. And nginx listens on 0.0.0.0:80 (or its equivalent). I thought for a moment that difference might be between IPv4 and IPv6, but I explicitly use IPv4 in the browser (http://192.168.7.2/info.php
to be precise.)– Jędrzej Dudkiewicz
Apr 12 at 18:03
You can confirm the full configuration with
nginx -T
(uppercase T
). My guess is that there is a default server block which will download files form the default document root.– Richard Smith
Apr 12 at 18:10
You can confirm the full configuration with
nginx -T
(uppercase T
). My guess is that there is a default server block which will download files form the default document root.– Richard Smith
Apr 12 at 18:10
Thanks for information. I've attached result of
nginx -T
but there is only one server
block. And please note, that with identical configuration and identical URL I get different results on Chrome and Firefox. Firefox tries to download file, Chrome displays expected result.– Jędrzej Dudkiewicz
yesterday
Thanks for information. I've attached result of
nginx -T
but there is only one server
block. And please note, that with identical configuration and identical URL I get different results on Chrome and Firefox. Firefox tries to download file, Chrome displays expected result.– Jędrzej Dudkiewicz
yesterday
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512143%2fnginx-php7-1-fpm-connection-using-firefox-returns-php-file-instead-of-result%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512143%2fnginx-php7-1-fpm-connection-using-firefox-returns-php-file-instead-of-result%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
How many
server
blocks does your configuration have? Where is the PHP file located - is it the same as the default Nginx root?– Richard Smith
Apr 12 at 17:55
From memory - nginx root is /var/www/html and this is where PHP file is located. There were no extensive changes from default nginx configuration, so I believe that there is only one
server
block block. And nginx listens on 0.0.0.0:80 (or its equivalent). I thought for a moment that difference might be between IPv4 and IPv6, but I explicitly use IPv4 in the browser (http://192.168.7.2/info.php
to be precise.)– Jędrzej Dudkiewicz
Apr 12 at 18:03
You can confirm the full configuration with
nginx -T
(uppercaseT
). My guess is that there is a default server block which will download files form the default document root.– Richard Smith
Apr 12 at 18:10
Thanks for information. I've attached result of
nginx -T
but there is only oneserver
block. And please note, that with identical configuration and identical URL I get different results on Chrome and Firefox. Firefox tries to download file, Chrome displays expected result.– Jędrzej Dudkiewicz
yesterday