You need to specify document_root option, and return MG_FALSE for the files
inside document_root.


On Fri, Apr 25, 2014 at 8:23 PM, Gustavo Santana
<[email protected]>wrote:

> Hi everybody!
>
> I compiled the hello.c example but when I acess localhost:8080 I get the
> message:
> "Hello! Requested URI is [/], query string is [(none)]"
>
> I want to load the index.html file that is in the same folder of hello bin
>
> What is the problem?
>
> I'm using ubuntu and here is the source:
>
> #include <stdio.h>
> #include <string.h>
> #include "mongoose.h"
>
> // This function will be called by mongoose on every new request
> static int index_html(struct mg_connection *conn) {
>   mg_printf_data(conn, "Hello! Requested URI is [%s], query string is
> [%s]",
>                  conn->uri,
>                  conn->query_string == NULL ? "(none)" :
> conn->query_string);
>   return 0;
> }
>
> int main(void) {
>   struct mg_server *server;
>
>   // Create and configure the server
>   server = mg_create_server(NULL);
>   mg_set_option(server, "listening_port", "8080");
>   mg_add_uri_handler(server, "/", index_html);
>
>   // Serve request. Hit Ctrl-C to terminate the program
>   printf("Starting on port %s\n", mg_get_option(server, "listening_port"));
>   for (;;) {
>     mg_poll_server(server, 1000);
>   }
>
>   // Cleanup, and free server instance
>   mg_destroy_server(&server);
>
>   return 0;
> }
>
>
>
> Best regards
> Gustavo
>
> --
> You received this message because you are subscribed to the Google Groups
> "mongoose-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/mongoose-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to