1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Raspberry Pi 3 & Web Server

Discussion in 'ARM' started by ronsimpson, Nov 22, 2016.

  1. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,315
    Likes:
    970
    Location:
    Loveland, CO USA
    ONLINE
    I am trying to replace my home control computer with a Raspberry Pi.
    The 16 to 18 year old computer has internet connections so I need the Pi to also have a web server functions.
    http://readwrite.com/2014/06/27/raspberry-pi-web-server-website-hosting/
    Went to the above link:
    Installed Apache:
    All very easy.
    Problem is I can't get to the Pi from any PC running FireFox or Internet Explorer.
    I can see the Pi from any Android running Chrome.

    So it is some what working.
    More when I get this problem solved.
    --edited--
    https://www.raspberrypi.org/documentation/remote-access/web-server/apache.md
     
    Last edited: Nov 22, 2016
  2. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,315
    Likes:
    970
    Location:
    Loveland, CO USA
    ONLINE
    More:
    Just found out that the web server dose not work when the screen saver is on. LOL That is probably easy to fix.

    Also:
    A PC can 'ping' the raspberry at 127.0.0.1 but not at 192.168.123.15.
    A PC finds nothing at 192.168.123.15 but a Android finds a web page.
    I have a feeling I need to know more about networks.
     
  3. dougy83

    dougy83 Well-Known Member

    Joined:
    May 18, 2008
    Messages:
    2,674
    Likes:
    215
    Location:
    Brisbane, Australia
    How can a PC ping the Pi at 127.0.0.1? The PC would be pinging itself ;).
    Have you tried http://192.168.123.15 as well as https://192.168.123.15? Or 192.168.123.15:80, 192.168.123.15:8080, 192.168.123.15:443?
     
    • Like Like x 1
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,315
    Likes:
    970
    Location:
    Loveland, CO USA
    ONLINE

    When I ask the Raspberry its address it said: (sudo hostname -a)
    127.0.0.1
    192.168.123.255
    192.168.123.15
    I did not under stand 127.0.0.1 thank you.
    http://http//192.168.123.15 (with or with out a port number :80 or :8080 or 43)
    With out the "http://" I get:
    ----edited----
    From a Android; I get a ping back:
    192.168.123.15-WORKGROUP/RASPBERRYPI-0 b8:27:eb:27:f9:e0
    Using a program called ¨Ping & DNS
    ----edited----
    On the Raspberry Pi in a terminal window "sudo ping 192.168.123.10 -c 10"
    This pinged my PC.
    On the PC ping 192.168.123.15
    This pinged my Pi.
    Now from the PC I can see the web page on the Pi.
    I do not know why but pinging from the Pi to the PC started it working.
     
    Last edited: Nov 24, 2016
  6. dougy83

    dougy83 Well-Known Member

    Joined:
    May 18, 2008
    Messages:
    2,674
    Likes:
    215
    Location:
    Brisbane, Australia
    Sorry, I'm not sure what the problem is. By "Android", are you meaning mobile devices connecting to your router via wifi?

    What is the IP of your PC? 192.168.1.xxx? If so, try changing the IP of the pi to 192.168.1.yyy, so that they're on the same subnet (assumed mask of 255.255.255.0).
     
  7. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,315
    Likes:
    970
    Location:
    Loveland, CO USA
    ONLINE
    I have the router handing out addresses. It assigned the PC at 192.168.123.10 and the Pi at 192.168.123.15.
    For some reason, every time the Pi is reset or goes into screen saver, I have to ping from the Pi to get a connection again.

    By Android I am using phones and tablet. All the Androids are addressed in the 192.168.123.1 through .20 range.
    ---more---
    I have to ping each PC before I can make a connection to that PC.
     
    Last edited: Nov 24, 2016
  8. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    You can set a static address to the PI, I have only used the PI2 though. I would seriously recommend putting the main OS on the sd card and using a USB stick as 'main drive', I got through loads of sd cards on my pi.

    What linux you using on the PI? I got a load of notes on the pi somewhere, I found alot of useless info on the pi and brought a ton of useless books! But slowly built up a reasonable file on them, not sure how dissimilar the Pi3 is to the pi2. it should be easy to turn the screen off, I run the pi headless or normally using something like VNC.
     
  9. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    127.0.0.1 is the same thing as 'local host' its just the ip address of the machine you are using. You need to find out what port the apache server running from and make sure that the router is port forwarded for that port. OR change the port of the apache server to one that is open.

    Also sounds like the pi is trying to set the Ip addresses as well, I tether to the internet via android as we cant get broad band in my area. I get all kinds of network issues with tethering, I have to make sure that only one device is handing out the IP's, in your case I think you have both the router and pi trying to set addresses.
     
  10. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    Are you running the pi wireless? If so there is a known problem with reconnection, its in one of the books I sent you a pm about. There is several scripts to get around it and a fix offered in the book, I think it applies to wireless systems only. the book says the following........

    "The allow-hotplug command will do as the name suggests; it allows you to plug in
    and out wireless adapters assigned to the wlan0 interface. Auto wlan0 tells Raspbian
    to confgure the interface automatically based on the settings you provide.
    We need to replace the SSID and password with the details of your router, keeping
    the text enclosed with quotation marks. This is the most basic confguration that
    can be used.
    There is one problem with this confguration though; if the wireless network is
    disconnected, the interface will not be brought back automatically. There are many
    scripts that try to solve this problem. The confguration requires that you know extra
    details about the wireless confguration. The next section offers a fully automatic
    way of doing this though. "


    It then gives alot of information on how to configure things to get around these problems.
     
  11. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    Ron I am having mares sending the books!! let me know when your ready, i will try and stuff them on a google drive thingy. But I cant keep then on long as I use the space.
     

Share This Page