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!

Soeren
  • 21
  • 2

1 Answers1

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.

Mohi Rostami
  • 4,434
  • 1
  • 20
  • 39