[Gambas-user] Configure real httpd for gb.web.form

PICCORO McKAY Lenz mckaygerhard at ...626...
Tue Mar 14 01:42:34 CET 2017


2017-03-13 18:09 GMT-04:00 Tobias Boege <taboege at ...626...>:

> On Thu, 16 Feb 2017, Benoît Minisini wrote:
> > > Normal Gambas CGI, i.e. a Gambas script with gb.web, also works fine.
> > >
> > > But I have no idea about gb.web.form.
> >
> > Projects using gb.web.form are CGI scripts too, no difference.
>

after too much reading and testing, proyects with or without web.form
compiled produce a gambas exceutable file

Nginx doesn't have native CGI support (it supports fastCGI instead). The
typical solution for this is to run your gambas script as a fastCGI process
and edit the nginx config file to re-direct requests to the fastCGI
process. This is quite a complex solution if all you want to do is run a
CGI script.

a trick lke the gambasforge does, rename the gambas executable file and
added a extension, and follow the same recipe as do with perl.. as i said
this are quite complicated process due there's no wrapper for gambas cgi
scripts.. so must be a socket that ngynx can listen to manage the
cgi/gambas program as real cgi

> >
> > > I read around in the gb.httpd
> > > source code and kind of get its control flow but I'm none the wiser
> > > about how to set up an external HTTP server to work with this
> component.
> > > In particular I would run the .gambas executable archive on every
> request,
> > > which, I presume, involves rewriting the request URL, i.e.
> > >
> > >   /my/project.gambas/x
> > >
> > > should be redirected to
> > >
> > >   /my/project.gambas
> > >
> > > while setting Request.Path to "/x".
> > >
> > > I'm not sure if any other information about my setup is useful here.
> > > I think I succeeded in redirecting all requests to my program and by
> > > setting PATH_INFO from the original request URL, I get a meaningful
> > > Request.Path in Gambas.  The result being that the skeleton HTML of my
> > > page is shown but it's not responsive at all (and it appears to be the
> > > wrong page, i.e. the wrong Webform.Startup, indicating that probably
> > > Session management doesn't work). It also seems like the browser is not
> > > able to communicate with gb.web.form.
> > >
> > > Instead of trying to debug my setup which looks completely wrong, my
> > > question would be if someone has a working configuration for this type
> > > of project for any HTTP server (that isn't gb.httpd) -- in the hope
> > > that I can go from there to nginx.
> > >
> > > Regards,
> > > Tobi
> > >
> >
> > Example with the configuration file of lighttpd:
> >
> > ...
> > # This tells that all and executable files are cgi scripts,
> > # and just them
> > cgi.execute-x-only = "enable"
> > cgi.assign = ( "" => "" )
> > ...
> > # This tell that the "/manager" URL is associated with the CGI script
> > alias.url = ( "/manager" => "/path/to/MyCgiScript.gambas" )
> >
>
> I've had more success with these 3 lines in lighttpd than in nginx
> (I guess because lighttpd sets CGI variables differently), but I'm
> not able to run *my* project.
>
> I'm sure there are several things wrong with it. For one I'm unable to
> compile it completely (it crashes the compiler with a segfault, but only
> a minor thing in gbc_help.c, IIRC) -- now that I think about it, I'm
> not even sure if all compiled object files have the same version when
> I run the project... And I also mess a lot with Request.Path in my
> WebForm's HandleRequest() hook. It works with gb.httpd though, so it
> can't be that terrible.
>
> Sadly I'm with my back against a wall concerning time. So, for now my
> solution is the following:
>
>   1. Patch gb.httpd to recognise the GB_HTTPD_HOSTNAME environment
>      variable, which lets you specify the host to bind to (patch attached).
>   2. Run my project under gb.httpd (gbx3 -H), bind to an unused port,
>      e.g. GB_HTTPD_PORT=8080, and to GB_HTTPD_HOSTNAME=127.0.0.1.
>      This ensures that nobody not on localhost is able to accidentally
>      connect to the gb.httpd server directly.
>   3. Run nginx as a proxy HTTPS server for the local gb.httpd one. The
>      configuration for that is really simple:
>
>        server {
>          listen              443 ssl;
>          server_name         ...;
>          ssl_certificate     ...;
>          ssl_certificate_key ...;
>
>          location / {
>            proxy_pass http://127.0.0.1:8080;
>          }
>        }
>
> This accomplishes all I wanted, although I'm not too comfortable running
> gb.httpd instead of a properly maintained httpd. I'll report back (possibly
> in a new thread) once I sort this out.
>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>



More information about the User mailing list