How to execute C based CGI binary with mongoose web server

851 views
Skip to first unread message

Aurovind Sagar

unread,
Dec 2, 2015, 1:29:51 AM12/2/15
to mongoose-users
I am new to mongoose. What I got to know is that mongoose supports CGI binary execution. But its not working in my set-up. I am using 3.7 mongoose and I cannot change my version for work reasons. I tried by renaming to ".cgi". I tried giving the configuration option -cgi_pattern

Sergey Lyubka

unread,
Dec 2, 2015, 1:55:17 AM12/2/15
to mongoose-users
Hi Aurovind.

1. What environment are you using?
2. Elaborate on what exactly config are you using and what results do you get.

On Wed, Dec 2, 2015 at 6:29 AM, Aurovind Sagar <eas...@gmail.com> wrote:
I am new to mongoose. What I got to know is that mongoose supports CGI binary execution. But its not working in my set-up. I am using 3.7 mongoose and I cannot change my version for work reasons. I tried by renaming to ".cgi". I tried giving the configuration option -cgi_pattern

--
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 mongoose-user...@googlegroups.com.
To post to this group, send email to mongoos...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/d/optout.

Prasanth G

unread,
Dec 2, 2015, 2:36:56 AM12/2/15
to mongoose-users
Hi Sergey, 

Thanks for responding. Me and Aurovind were using it in an embedded platform which is linux based.
The configs we tried out are, 

mongoose
-document_root /cgi-bin/
-cgi_pattern /cgi-bin/**.*
-listening_ports 8047

I've c based executable in /cgi-bin/ location with extension .cgi. But when I give http request using browser, in my browser I get, Error 404: Not Found, File not Found.

Any help will be appreciated.

Thanks,
Prasanth

chrisj...@gmail.com

unread,
Dec 2, 2015, 5:36:51 AM12/2/15
to mongoose-users


On Wednesday, December 2, 2015 at 7:36:56 AM UTC, Prasanth G wrote:
Hi Sergey, 

-document_root /cgi-bin/
-cgi_pattern /cgi-bin/**.*
-listening_ports 8047

I use Mongoose 3.2 to run cgi with executables written in both C and VB5! My configuration file contains:

cgi_pattern **.exe$|**.pl$|**.php$

document root points to the folder that contains both mongoose.exe and mongoose.conf

Regards
Chris

Aurovind Sagar

unread,
Dec 2, 2015, 7:24:22 AM12/2/15
to mongoose-users
In linux .exe pattern wont work right?
So should it be **.cgi$|** ?

chrisj...@gmail.com

unread,
Dec 2, 2015, 8:15:00 AM12/2/15
to mongoose-users


On Wednesday, December 2, 2015 at 12:24:22 PM UTC, Aurovind Sagar wrote:
In linux .exe pattern wont work right?
So should it be **.cgi$|** ?


I keep the executables in cgi-bin under the document root, and the URL references them as .../cgi-bin/whatever.exe. It is many years since I worked with Linux, but I seem to remember you can call the executables pretty much anything, so you will need Sergey or another knowledgeable person to tell you what the pattern should be for your naming convention.

Regards
Chris

Sergey Lyubka

unread,
Dec 2, 2015, 8:30:47 AM12/2/15
to mongoose-users
On Wed, Dec 2, 2015 at 7:36 AM, Prasanth G <pras...@gmail.com> wrote:
Hi Sergey, 

Thanks for responding. Me and Aurovind were using it in an embedded platform which is linux based.
The configs we tried out are, 

mongoose
-document_root /cgi-bin/
-cgi_pattern /cgi-bin/**.*
-listening_ports 8047

Here's what I suggest.

File system layout:

    /web_root/
              index.html
              ... other html , css , js  files ...
              cgi-bin/
                      ... CGI scripts...


Configuration:
              
        mongoose -document_root '/web_root' -cgi_pattern '/cgi-bin/**' -listening_ports 8047


Regards,
Reply all
Reply to author
Forward
0 new messages