Author Topic: Questions on an Apache2 web server  (Read 248 times)

0 Members and 1 Guest are viewing this topic.

Offline bchwdlks

  • Senior Contributor
  • ****
  • Posts: 172
Questions on an Apache2 web server
« on: February 16, 2021, 03:03:06 PM »
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?

Offline ConligWX

  • Forecaster
  • *****
  • Posts: 748
  • #conligwx
    • conligwx.org
Re: Questions on an Apache2 web server
« Reply #1 on: February 16, 2021, 06:59:53 PM »
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.
« Last Edit: February 16, 2021, 07:02:07 PM by ConligWX »
Regards Simon
Davis Vantage Pro2 Plus (6162UK) Daytime FARS WeatherLink Live AirLink PurpleAir PA-II-SD CumulusMX


Offline bchwdlks

  • Senior Contributor
  • ****
  • Posts: 172
Re: Questions on an Apache2 web server
« Reply #2 on: February 17, 2021, 01:46:14 PM »
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.


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8282
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Questions on an Apache2 web server
« Reply #3 on: February 17, 2021, 02:26:40 PM »
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.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline bchwdlks

  • Senior Contributor
  • ****
  • Posts: 172
Re: Questions on an Apache2 web server
« Reply #4 on: February 18, 2021, 02:17:00 PM »
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?"

Offline BrianLehan

  • Senior Member
  • **
  • Posts: 85
    • Grace C Lehan Memorial Weather Station
Re: Questions on an Apache2 web server
« Reply #5 on: February 19, 2021, 05:44:41 PM »
Could the browser settings be set to save for that type on one and not on the other??
Davis Vantage Pro 2 plus
VWS 15x on Windows 7
Sarasota-Weather Template
Gr3 Radar

Offline bchwdlks

  • Senior Contributor
  • ****
  • Posts: 172
Re: Questions on an Apache2 web server
« Reply #6 on: February 20, 2021, 08:29:44 AM »
Could the browser settings be set to save for that type on one and not on the other??

Good idea --- but that is where I started looking. I chased down that trail before I started looking at the apache servers. The results there were that IE displayed files from both servers & the user had to request that the the be saved or 'open with app'. I had 3 different Chrome based browsers (Chrome, Edge and Opera) installed on Windows and they all behaved the same. I even went so far as to completely reset Chrome & start completely generic (no cache files, no addons, no extensions, etc.)  Also tablets/cell phones do the same so I am convinced that the web servers are the control point for this.

I have quit chasing this since it only took about 30 seconds reset the scripts so that log files have no extension.