We’d like to remind Forumites to please avoid political debate on the Forum.

This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide

Apache help on raspberry Pi

martyp
martyp Posts: 1,089 Forumite
Part of the Furniture 500 Posts Combo Breaker
Hi all,

I've made a Pi into a webserver which has two projects running acquiring data from both my wifi thermostat and weather station.
I can't figure out how you make a folder visible or accessible on the website.

The data is contained in two folders under \home\pi\

The one available is accessed via:
http://raspberrypi/~pi/heatmiser-wifi
The folder on the Pi is \home\pi\public_html\heatmiser-wifi

The folder I want adding is located at:
\home\pi\webdata

If I go to http://raspberrypi/~pi/
It shows the one folder, heatmiser-wifi

I'm going to use the file \var\www\index.html as the main webpage for the site and link webpages in both the above folders but haven't a clue how I do it? I'm worried that if I move the folders it will upset the scripts etc. which publish the live data to them...

Hoping someone can maybe advise please?

I'm really confused... :(

Comments

  • RobTang
    RobTang Posts: 1,064 Forumite
    You need to use mod_alias in your apache config.


    http://httpd.apache.org/docs/2.2/mod/mod_alias.html


    With this you can make the other folder accessible through a url, you can the link to I from wherever
  • S0litaire
    S0litaire Posts: 3,535 Forumite
    Part of the Furniture 1,000 Posts Combo Breaker
    You could do it the quick dirty and lazy way.. ^_~

    From the command line type:
    ln -s -t /var/www/ /home/pi/webdata
    
    That puts a symbolic link (think of it as a shortcut) from /home/pi/webdata to /var/www/
    not sure if you will need super user rights if you do put 'sudo' at the start then enter your password as required.

    so when you type in http://raspberrypi/webdata you get the second set of data.


    it's not the right way to do things, but it saves a lot of time in a test or home environment, with all the stopping and restarting web services after every change. ^_^
    Laters

    Sol

    "Have you found the secrets of the universe? Asked Zebade "I'm sure I left them here somewhere"
  • RobTang
    RobTang Posts: 1,064 Forumite
    S0litaire wrote: »
    You could do it the quick dirty and lazy way.. ^_~

    From the command line type:
    ln -s -t /var/www/ /home/pi/webdata
    
    That puts a symbolic link (think of it as a shortcut) from /home/pi/webdata to /var/www/
    not sure if you will need super user rights if you do put 'sudo' at the start then enter your password as required.

    so when you type in http://raspberrypi/webdata you get the second set of data.


    it's not the right way to do things, but it saves a lot of time in a test or home environment, with all the stopping and restarting web services after every change. ^_^


    Dodgy but I like it.


    Apache doesn't transparently follow symlinks so if it doesn't work you need to check that option is enabled (option is enabled by default so it should work)
  • martyp
    martyp Posts: 1,089 Forumite
    Part of the Furniture 500 Posts Combo Breaker
    Excellent, thanks both :) Great to have the different options too. I'm really pleased I got both my planned projects working together. I want to expand the website capabilities for home automation functions etc as well.
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 353.5K Banking & Borrowing
  • 254.1K Reduce Debt & Boost Income
  • 455K Spending & Discounts
  • 246.6K Work, Benefits & Business
  • 602.9K Mortgages, Homes & Bills
  • 178.1K Life & Family
  • 260.6K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16K Discuss & Feedback
  • 37.7K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.