2

On the Raspberry Pi, I have an html-file which I can view when directly logged into the Raspberry Pi. The page is shown on a display that is directly connected to the Raspberry Pi.

Now I want to invoke that file using Firefox or Edge on my PC. I've tried a lot of combinations in the address line of the browser, none of them worked.

For example:
http://192.168.178.200/file:///opt/openhab/configurations/sitemaps/dashboard.html
or
http://192.168.178.200:8080/opt/openhab/configurations/sitemaps/dashboard.html

IP-address of the Raspberry Pi: 192.168.178.200
Port which is used by the openHAB web server: 8080
Path to the html-file: /opt/openhab/configurations/sitemaps
Name of the html-file: dashboard.html

Please help me to create an address line to invoke that html-file.
Thank you very much!

  • Hello, openHab is not a webserver per-se but this might help: openhab.org/docs/configuration/ui/classic/#accessing-sitemaps. In your case something like 192.168.178.200:8080/classicui might get you started... – Roger Jones Jan 16 at 15:45
  • Thank, I'll have a look at it. On the Raspberry I just use this: file:///opt/openhab/configurations/sitemaps/dashboard.html – Soeren Jan 16 at 15:50
  • The problem seems to be that I don't want to access a sitemap but just an html-file which is not directly linked to openHab. – Soeren Jan 16 at 15:53
  • OK, in that case you'll need to work out the document root for the openHAB webserver and use the URL that's relative to that. It might well be that you'll not be able to navigate to it this way (i.e. it's not being served by the webserver) in which case you'll have to install a new webserver that does or change the openHAB settings somehow. – Roger Jones Jan 16 at 16:24
  • Hello and welcome to this community. I just read these comments but answered. You should change the title and body of the question. It's not about linking/redirecting a web page, as @RogerJones said, it's related to OpenHAB! – M. Rostami Jan 16 at 16:44
1

You can easily do it by a simple package named apache. It's a powerful web server, however, you can accomplish what you said by it.

1. Install Apache:

sudo apt-get install apache2  

2. Start the service:

sudo service apache2 start

3. Open the browser of the Raspberry Pi and open http://localhost/ address by a browser. You'll something like the picture below:

enter image description here

Next, do it by another host/PC on the network. Note that in this case, you need to open http://raspberrypi.local, http://raspberrypi or http://[Raspberrypi's-IP-Address].

4. Put your .html files in the /var/www/html/ directory. As an example, I had a folder named "khar" and in this folder, I had two files, gav.html and sag.html.

4.1. Move/copy folder to the apache's directory:

cp -r khar /var/www/html/  

4.2. Now, I can open .html files by opening http://raspberrypi/gav.html or http://raspberrypi/sag.html in the browser.

If you want this service start at startup, do it:

sudo systemctl enable apache2 

UPDATE:
It's not about linking/redirecting a web page, as @RogerJones said, it's related to OpenHAB!

Open the OpenHAB config file and change OPENHAB_HTTP_ADDRESS=127.0.0.1 to OPENHAB_HTTP_ADDRESS=192.168.178.20 if the PC's IP address is 192.168.178.20.
If you don't want to make a limitation, comment it #OPENHAB_HTTP_ADDRESS=127.0.0.1.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.