r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[CGI] web server issues

Maarten
24-Nov-2007
[780x6]
I am also adding a routing scheme (dialect) so basically you redirect 
all traffic except static stuff to a fastcgi process, it comes in 
the router and then it checks on extension or path (REST) what to 
do.
The generating part will be asking you a few questions and the generate 
matchhing config files and binaries that you can copy to an empty 
Linux box with only lighttpd installed (or enginx)
Session management is database-backed, so scaling up is hiring VPS'es 
and putting pound in between
With the avereage memory use fo Rebol < 10Mb you can coompute how 
many users I can concurrently server for complex operations (100-200 
minimum), so every machine I hire can host 500 customers. That means 
that I should earn e0.50 customer to get  a decent margin (roughly).
earn = ask
I finally learned the trick: 1) create a good interface (but w eknew 
that) 2) use back-end technology that lowers the cost per user (i.e. 
enlarges the # users per box)
Robert
25-Nov-2007
[786]
Maarten, this sounds very cool. So the goal is to have a scalable 
web-service framwork based on fastCGI and simple tools?
Maarten
25-Nov-2007
[787x5]
That's how I should have described it in one sentence.
But  yes: load-balancer -> webserver(*) -> FastCGI(*) -> MySQL
FastCGI is a rebol process with core enhancements, session mgt, RSP 
etc. I am also integrating autodoc from Gabriele so the files will 
be more "literate" and I have a module management system in place 
thathandles from interactive to encap.
I am using assembla.com from SVN and trac, the actual application 
I am building is for personal life management.
As a rebol process is only 10 Mb.... I can serve lots of users on 
cheap VPS's, load balance them, data backup in S3.  No others invited 
until I get things stable enough. eed to ge things going
Robert
25-Nov-2007
[792]
Sounds very cool. Go for it!!
Pekr
25-Nov-2007
[793x2]
I don't understand it a bit. I can understand webserver, fastcgi, 
mysql part, but what is that load-balancer part? Client side?
or some special server part?
Maarten
25-Nov-2007
[795]
No, before the webserver, so you scale transparantly to multiple 
webservers (in my scenario each webserver effectively is the load 
balancer for X FastCGI rebol processes; it's how nginx and lighty 
work)
eFishAnt
9-Mar-2009
[796]
What are the best ways to protect source code from view in a cgi 
script?  When a script is made world-viewable, isn't that compromising 
the source pretty badly?
Sunanda
9-Mar-2009
[797]
You want to set the file permissions for each script  globally executable, 
but not globally readable.

Also protect the cgi-bin folder from being read by the whole world...If 
you are using Apache, look at the IndexIgnore directive:

http://httpd.apache.org/docs/1.3/mod/mod_autoindex.html#indexignore
Pekr
8-Apr-2009
[798x2]
One of my clients updates his site via some tool, which always seem 
to add some space between the lines. After some time, the page is 
instead of 400 rows something like 13K rows - the size goes from 
cca 25KB to 100KB. So I wrote a cgi script, which reads index.html 
and removes blank lines. Everything is OK, when I run the script 
from the console. But when I run it via a browser as a CGI script 
call, it can't write the file. Dunno why - cgi-script is being run 
using -cs switch, I even put secure none in there, cgi-script has 
the same own, grp set as index.html, but I can't write it ....
Maybe I should try the trick to connect to the FTP account and upload 
it there, instead of rewriting? :-)
Anton
8-Apr-2009
[800]
Check the permissions of the file to be written. Are you also sure 
the cgi script is being executed? Check its permissions too..
Pekr
8-Apr-2009
[801x2]
I am sure, as I get cgi script output to the browser window. It just 
fails on the last line - write/lines %index.htm data
permissions look OK, but I will recheck. Dunno what user Apache runs 
cgi scripts under, so I better check it is others writeable ....
Anton
8-Apr-2009
[803]
Maybe the cgi script current directory is not where the index.htm 
file is.
See if you can list the file, eg. instead of 
	write/lines %index.htm data
do this:
	print mold info? %index.htm
Pekr
8-Apr-2009
[804x3]
no, it is a different directory .... the script is being run in /cgi-bin/, 
while index.htm is at the root of the web ...
hmm, maybe I found the problem - it has rw--r--r-- file permissions 
....
Changed index.html permission to 646, and it works now. Maybe CGI 
scripts are being run under the Apache user or group, who knows. 
Thanks for pointers!
Anton
8-Apr-2009
[807]
Did you try 664 first ?
Pekr
8-Apr-2009
[808]
no, I can try once I get at home ... that might be more secure solution, 
thanks ...
Anton
8-Apr-2009
[809]
What is the tool your client uses which produces the extra lines? 
It is the source of the problem.
Pekr
8-Apr-2009
[810]
some old Mozilla web building SW, don't remember its name. It was 
some three letters name. But - maybe one of my friends is doing some 
small Rebol client app edits (putting news into the main site), so 
maybe it is his script which does so. I need to check with him, it 
is an encapped app, so I can't see the sources ...
Anton
8-Apr-2009
[811]
Yeah, definitely check that. If it's rebol, then it can be easily 
fixed.
Chris
8-Apr-2009
[812]
NVU?
Pekr
8-Apr-2009
[813]
NVU is old Mozilla attempt to separate page editor into something 
like FrontPage. I think it is not developed anymore, but some ppl 
do continue with developments under the name Kompozer. More info 
here - https://wiki.mozilla.org/NVU:Home_Page
Maxim
9-Jun-2009
[814x2]
is there a ways to know if a rebol script is being run as cgi or 
as a stand-alone?
I want to print out an html error when run from cgi, but execute 
code when run stand-alone.
Graham
9-Jun-2009
[816]
system/options/cgi
Maxim
9-Jun-2009
[817]
ahhh yes, I can use the cgi headers to see if they are set... that 
was obvious... seems, I'm still not fully recuperated from the virus 
which I've been "nurturing" for a few days now.
amacleod
9-Jun-2009
[818x2]
I'll have a static ip by next week so I hope that solves this issue 
for me..
wrong group...sorry
amacleod
10-Jul-2010
[820x2]
I want to access a mysql db via a cgi interface directly with a rebol 
client.


I have a cgi script  that accesses the db and prints the results 
which I can read with the client but is this the best method? Is 
there a way to send the data directly to the client as rebol blocks 
or do I need to essestialy parse a cgi built web page as I am doing?
I know I can use mysql-protocol to access mysql directly but that 
is not hat I mean as sometimes that is not possible/allowed by some 
isp's.
Graham
10-Jul-2010
[822:last]
The ISP owns the mysql db .. and opens up some tables for you to 
use.  So, no, it's not possible unless you run your own Vm like as 
on Amazon or linode or slicehost or whatever.