[Medusa-dev] help getting started
dsavitsk at mail.e-coli.net
Fri Dec 20 17:55:42 EST 2002
These are very newbie questions on getting up and running with medusa. If people can help me get a foothold, I will be happy to write up a "getting started with medusa" document to post somewhere.
In general, I am trying to run 2 websites www.a.com and www.b.com on a single server (on FreeBSD 4.7 fwiw), but they should stay invisible to each other. a.com should be rooted at /usr/www/a and b.com in /usr/www/b. I would also like to use a directory for each for scripts (/usr/www/a/bin and /usr/www/b/bin most likely.)
Here is where I am starting as far as an edit of the "start_medusa.py" script:
from medusa import http_server
from medusa import monitor
from medusa import filesys
from medusa import default_handler
from medusa import status_handler
from medusa import resolver
from medusa import logger
HOSTNAME1 = 'www.a.com'
HOSTNAME2 = 'www.b.com'
IP_ADDRESS = ''
PUBLISHING_ROOT1 = '/home/www/a'
PUBLISHING_ROOT2 = '/home/www/b'
HTTP_PORT = 80
MONITOR_PORT = 9999
rs = resolver.caching_resolver('127.0.0.1')
lg = logger.syslog_logger('/dev/log')
lg = status_handler.logger_for_status(lg)
fsa = filesys.os_filesystem(PUBLISHING_ROOT1)
fsb = filesys.os_filesystem(PUBLISHING_ROOT2)
dha = default_handler.default_handler(fsa)
hsa = http_server.http_server(IP_ADDRESS, HTTP_PORT, rs, lg)
dhb = default_handler.default_handler(fsb)
hsb = http_server.http_server(IP_ADDRESS, HTTP_PORT, rs, lg)
if os.name == 'posix':
from medusa import unix_user_handler
uh = unix_user_handler.unix_user_handler('public_html')
ms = monitor.secure_monitor_server('password', '', MONITOR_PORT)
status_objects = [hsa, hsb, ms, rs, lg]
sh = status_handler.status_extension(status_objects)
if os.name == 'posix':
if hasattr (os, 'seteuid'):
[uid, gid] = pwd.getpwnam ('nobody')[2:4]
The things that I know are totally wrong are that there is no association from HOSTNAME* to PUBLISHING_ROOT* (and maybe more to the point, is this the proper way to set up 2 distinct domain names), and I don't know how to start adding a scripts directory, or indeed how to structure scripts (that is, can they simply return a string, or is there more to it).
I guess there are 3 other questions,
1. how does one allow directory browsing? this seems to not happen by default. Is it simply adding another handler?
2. is there support for server side includes, or will i need to make everything a script to append some generic headers,
and 3. are there problems with blocking during script execution, and are threads the proper way to solve this if it is a problem.
Thanks for any help to this long and not very interesting list of questions.
More information about the Medusa-dev