Miscellaneous Debris > Tech Corner

Questions on an Apache2 web server

(1/2) > >>

bchwdlks:
What controls whether a web server displays a file to the screen or downloads it?  I am in the process of moving some in-house weather programs from a Pi 2B+ to a Pi 3B with a USB drive.

Rpi 2b+ Apache2 version --   Server version: Apache/2.4.10 (Raspbian)
                                          Server built:   Sep 30 2019 22:23:47


Rpi 3b  Apache2 version --      Server version: Apache/2.4.38 (Raspbian)
                                            Server built:   2020-08-25T20:08:29


If using Chrome browser in Windows10, Apache ver 2.4.10 will display the contents to the screen for a file that ends in txt or log. Version 2.4.38 will either save the file to the drive or save it and then open it in a windows program. How do I change this behavior?

ConligWX:
probably your httpd.conf is different perhaps?  did you not backup/migrate the httpd.conf php.ini and any of apache config files?

look for

Addtype

Also the .htaccess files may have differences too.  check there for "addtype"  but you need to compare the old - against the new.

bchwdlks:
Thanks for the hints - but I have not found the solution yet.

Both of the apache versions have the same .htaccess file. It is a single line -- "AddCharset UTF-8 .txt"
The php on the Pi2b+ is
      PHP 5.6.40-0+deb8u12 (cli) (built: Jun 28 2020 18:04:15)

The php on the Pi3b+ is  :
      PHP 7.3.19-1~deb10u1 (cli) (built: Jul  5 2020 06:46:45) ( NTS )
      
Both servers have 2 versions of php.ini - 1 in the /etc/php/cli directory and 1 in the /etc/php/apache2/   

My explanation of the problem did not fully state what I am doing. The function of the Pi2B+ is a WU weather camera feed. I made no attempt to move any web application from the old server to the new, so I did not attempt to transfer any configuration files. The Pi3 is also my backup for Weatherlink6.0. It uses weewx utilities / mariaDB to put the wlk files into a sql database. 

The Pi2 gets a image from a web camera with a wget, gets the weather data from a Meteobridge, uses 'imagemagick' to combine the two and then it ftps the result to WU. The txt file is the results of that process so that I can see how oftern WU refuses the file. The other task on the Pi2 is receiving pictures from a camera monitoring a driveway and several wildlife cameras. A cron job runs multiple times per day to build a photo album - images separated by date and with thumbnails ('album' is the program). I have upgraded the weather camera and I am in the process to set it up on the Pi3 and then turn off the Pi2 process when I am happy with the new. It is a pain to look at txt files on a tablet or phone by downloading to the device and then opening.

saratogaWX:
In the same directory as httpd.conf, compare the old:new mime.types files .. you may be missing some declarations about the types for .txt and .log formats.

bchwdlks:
Thanks for the help but I never did find the answer.

What I did find out is that 'httpd.conf' is not used in apache2 -- instead it uses 'apache2.conf'. After I discovered that, I thought I was heading for the answer. But no luck -- all of the config files used were almost identical.

So this will remain an 'I don't know why that happens' problem form me. My easy solution to my original problem --

DON'T USE a file extension!!!

I sure do wish that 2 days ago I had thought about a solution rather than 'why is it doing that?"

Navigation

[0] Message Index

[#] Next page

Go to full version