FAQ
Having problems with go simple webserver on linux.

I'm moving my apps to a debian production environment from my local dev on
ubuntu machine (also deployed fine OK on Openshift) and I can't get a http
response from my new VPS.

I have done a few installs, and can get apache, ssh, ftp running fine, but
the basic go http server example code will run without any errors but not
serve any requests.

I have tried using the os host and port environment variables method
Openshift uses, and no luck either.

Cant find anything about this, just wondered if there is any config needed
with iptables, permissions or else I should know about.

The code i'm using is the textbook http server go example.

Many thanks,

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Tom D at Jan 19, 2014 at 12:19 am
    Your probably binding the http server on localhost rather than all the
    interfaces.

    Consider the differences between the following example code:

    package main

    import (
    "log"
    "net/http"
    )

    func main() {
    // Simple static webserver:
    log.Fatal(http.ListenAndServe(":8080",
    http.FileServer(http.Dir("/usr/share/doc"))))
    }


    and this:



    package main

    import (
    "log"
    "net/http"
    )

    func main() {
    // Simple static webserver:
    log.Fatal(http.ListenAndServe("localhost:8080",
    http.FileServer(http.Dir("/usr/share/doc"))))
    }

    Only the former will work, as it binds to all interfaces.
    On Sunday, 19 January 2014 10:28:54 UTC+11, Alex Howard wrote:


    Having problems with go simple webserver on linux.

    I'm moving my apps to a debian production environment from my local dev on
    ubuntu machine (also deployed fine OK on Openshift) and I can't get a http
    response from my new VPS.

    I have done a few installs, and can get apache, ssh, ftp running fine, but
    the basic go http server example code will run without any errors but not
    serve any requests.

    I have tried using the os host and port environment variables method
    Openshift uses, and no luck either.

    Cant find anything about this, just wondered if there is any config needed
    with iptables, permissions or else I should know about.

    The code i'm using is the textbook http server go example.

    Many thanks,
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Alex Howard at Jan 19, 2014 at 12:26 am
    Many thanks good Sir, it's working

    On Sunday, 19 January 2014 01:19:28 UTC+1, Tom D wrote:

    Your probably binding the http server on localhost rather than all the
    interfaces.

    Consider the differences between the following example code:

    package main

    import (
    "log"
    "net/http"
    )

    func main() {
    // Simple static webserver:
    log.Fatal(http.ListenAndServe(":8080",
    http.FileServer(http.Dir("/usr/share/doc"))))
    }


    and this:



    package main

    import (
    "log"
    "net/http"
    )

    func main() {
    // Simple static webserver:
    log.Fatal(http.ListenAndServe("localhost:8080",
    http.FileServer(http.Dir("/usr/share/doc"))))
    }

    Only the former will work, as it binds to all interfaces.
    On Sunday, 19 January 2014 10:28:54 UTC+11, Alex Howard wrote:


    Having problems with go simple webserver on linux.

    I'm moving my apps to a debian production environment from my local dev
    on ubuntu machine (also deployed fine OK on Openshift) and I can't get a
    http response from my new VPS.

    I have done a few installs, and can get apache, ssh, ftp running fine,
    but the basic go http server example code will run without any errors but
    not serve any requests.

    I have tried using the os host and port environment variables method
    Openshift uses, and no luck either.

    Cant find anything about this, just wondered if there is any config
    needed with iptables, permissions or else I should know about.

    The code i'm using is the textbook http server go example.

    Many thanks,
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 18, '14 at 11:30p
activeJan 19, '14 at 12:26a
posts3
users2
websitegolang.org

2 users in discussion

Alex Howard: 2 posts Tom D: 1 post

People

Translate

site design / logo © 2022 Grokbase