things I don't understand

Discussion in 'Linux Networking' started by François Patte, Dec 3, 2013.

  1. Bonsoir,


    I am facing a problem that I don't understand: I try to help a friend to
    setup a web server on a mac.

    apache2 is installed and running; if I request the url http://127.0.0.1
    it is OK: "It Works!" is displayed.

    If I request the same url using localhost instead of 127.0.0.1, the
    answer is: firefox cannot connect to this site (something like this). I
    checked the file /etc/hosts and it is correct: "127.0.0.1
    localhost" is the first line.

    If I request http://192.168.1.12 (IP given by the livebox on the private
    network), it is also impossible to connect to the http server.


    I don't know much on mac, but I don't understand why it is possible to
    connect to the server through 127.0.0.1 and not with localhost, or IP
    address on the local network.


    If someone could give me some clues or test to perform, I will be
    gratefull to him...


    Thanks for attention.
     
    François Patte, Dec 3, 2013
    #1
    1. Advertisements

  2. François Patte a écrit :
    Then why post into a Linux newsgroup ?
    The *exact* error message is important.
    What happens is you run the following in a terminal :

    $ telnet localhost http
    Maybe the web server listens only on 127.0.0.1. You can check with netstat.
     
    Pascal Hambourg, Dec 3, 2013
    #2
    1. Advertisements

  3. François Patte

    Adam Wysocki Guest

    Do you have a proxy in firefox?

    AW
     
    Adam Wysocki, Dec 4, 2013
    #3
  4. Le 04/12/2013 00:20, Pascal Hambourg a écrit :
    I did not find a "mac.networking group...

    macOSX is a freebsd based system...

    La connexion a échoué
    (connection failed)

    Firefox ne peut établir de connexion avec le serveur à l'adresse
    86.xxx.xx.xx.

    FF cannot establish a connection with the server at this address...

    Le site est peut-être temporairement indisponible ou surchargé.
    Réessayez plus tard ;

    The site maybe busy, try later...

    Si vous n'arrivez à naviguer sur aucun site, vérifiez la connexion au
    réseau de votre ordinateur;

    If you cannot connect to any site, check your network connection

    (network is working)

    Si votre ordinateur ou votre réseau est protégé par un pare-feu ou un
    proxy, assurez-vous que firefox est autorisé à accéder au Web.

    If your computer or network uses a FW or a proxy...

    (no proxy, FW deactivated)
    connection refused
    netstat is strange on a mac, I used lsof...

    Anyway, what is ununderstable is that I can connect to the server using
    the local IP (127.0.0.1) and not using localhost... So the server listen
    on port 80 but it does not recognize the name localhost... in spite of
    /etc/hosts

    I did not change the default apache2 config files (which are the same as
    on linux).

    Thanks
     
    François Patte, Dec 4, 2013
    #4
  5. Le 03/12/2013 23:18, scrat a écrit :
    DNS for 127.0.0.1 ? hum!
     
    François Patte, Dec 4, 2013
    #5
  6. ^^^^^^^^^^^^

    That’s not a loopback address. You need to figure out why your web
    browser is trying to connect to that address.
    What is the complete output?

    What is the complete contents of /etc/hosts?
    So what does it say about the web server?
     
    Richard Kettlewell, Dec 4, 2013
    #6
  7. Oh, one other thing. What does ‘host localhost’ produce?
     
    Richard Kettlewell, Dec 4, 2013
    #7
  8. François Patte

    Adam Wysocki Guest

    So localhost resolves to *something*. Run:

    grep localhost /etc/hosts

    Is there only one localhost there?

    What if you ping localhost? What does it ping? Will it be this 83.... address
    that popped out in Firefox?

    AW
     
    Adam Wysocki, Dec 4, 2013
    #8
  9. François Patte

    Jorgen Grahn Guest

    Then why post into a Linux newsgroup ?

    /Jorgen
     
    Jorgen Grahn, Dec 4, 2013
    #9
  10. François Patte

    unruh Guest

    You do know that this is a linux newsgroup not a mac newsgroup?
    On linux the place which tells the resolver which places to look for ip
    addresses is in /etc/nsswitch.conf. It may also be there in Mac OS.
    hosts: mdns4_minimal files nis dns mdns4
    The important ones are the "files" which tells it to use /etc/hosts, and
    the dns, whichtells it to go out to the dns server in /etc/resolv.conf.
     
    unruh, Dec 4, 2013
    #10
  11. Le 05/12/2013 00:15, Jorgen Grahn a écrit :
    Sorry to have disturbed your list.... I hope you will recover soon.
     
    François Patte, Dec 5, 2013
    #11
  12. François Patte

    unruh Guest

    You ask for help in a group which has minimal knowledge of the system
    you want help for, and when asked you get snarky? I appologize for
    having replied to your post with an attempt to help.
     
    unruh, Dec 5, 2013
    #12
  13. Le 05/12/2013 19:54, unruh a écrit :
    I did not replied using your answer but an answer where there were
    absolutely no attempt to help; just words... If people have nothing to
    say, why do they say something?

    Has this list such a traffic that my small mail had scewed up the bandwidth?

    mac system is closed to unix system and I thought that someone with some
    knowledge in *networwing* could have some idea about my problem (and you
    did); my question was about the strange behaviour of apache which
    answers on 127.0.0.1 and not on localhost...

    For some people, if you talk about another system than the one they use,
    it is like to talk of the devil in a church and they immediately send a
    fatwa.
     
    François Patte, Dec 5, 2013
    #13
  14. François Patte

    Whiskers Guest

    Choosing a Subject that has something to do with your question, is
    always a good start. I've suggested an appropriate change.

    This web search <https://ixquick.com/do/search?q=apache+mac+osx> looks
    useful; the very first non-sponsored item I see is "Using Apache and PHP
    on MacOS X - Dev Articles"
    <www.devarticles.com/c/a/Apache/Using-Apache-and-PHP-on-Mac-OS-X/>

    If you want to run Unix or Linux open source software on a Mac, look at
    "Fink" <http://www.finkproject.org/>. But OS X apparently comes with
    Apache already installed, in Apple-ish form.
     
    Whiskers, Dec 5, 2013
    #14
  15. François Patte

    Thad Floryan Guest

    Thad Floryan, Dec 5, 2013
    #15
  16. Le 05/12/2013 23:25, scrat a écrit :
    I can fix apache config, but I need some lights on how to fix DNS
    resolving: 127.0.0.1 <----> localhost
     
    François Patte, Dec 6, 2013
    #16
  17. There’s some unanswered questions still in other branches of this
    thread. You might want to take a look at those.
     
    Richard Kettlewell, Dec 6, 2013
    #17
  18. François Patte

    unruh Guest

    I think he is saying that he has trouble getting localhost to resolv to
    127.0.0.1, not that it is working. I suggested he look in
    /etc/nsswitch.conf but he either never read that part of my post or
    ignored it. I have no idea if that is what Mac OsX calls it either.
     
    unruh, Dec 7, 2013
    #18
  19. scrat a écrit :
    The OP just wants the local resolver to resolve localhost into
    127.0.0.1, which sounds legitimate to me. But as Richard said, too many
    questions have been left unanswered by the OP so far.
     
    Pascal Hambourg, Dec 7, 2013
    #19
  20. Any chance it is trying to connect to ::1 instead of 127.0.0.1 when you
    use the name "localhost"? On my machine, at least telnet will try ::1
    before 127.0.0.1 even though the /etc/hosts file has the IPv4 localhost
    first.

    It's Linux, though, so OSX behavior may differ.

    - Andrew
     
    Andrew Gideon, Dec 9, 2013
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.