Vitor, The first time through is always the roughest. You'll get it working and the next time you'll be the expert.
I see no major issues, but there are a few thing that you could change. 1st don't define DocumentRoot at all. You don't want people accessing your gatekeeper.wsgi hook file or anything else in there. 2nd you should do something like this with the WSGIDaemonProcess WSGIDaemonProcess <some process> user=<some user> group=<some group> \ processes=3 threads=10 maximum-requests=1000 WSGIProcessGroup <some process> Adding a user and group makes it easy to see what is running in a ps -ef. Also you should always have a 'maximum-requests', this will limit the number of request any one thread will process thus avoiding memory leaks. All apps leak memory so don't assume your code won't I know for a fact that Python itself leaks memory. Maybe Graham will find something else. He's the author of mod_wsgi so he is the definitive source of info on it. Also you can check the docs for mod_wsgi, Graham is very thorough documenter. http://code.google.com/p/modwsgi/w/list ~Carl On Wed, Apr 21, 2010 at 10:08 AM, noisebleed <vitorbrandao...@gmail.com> wrote: > The file is a bit long (it's using SSL) but the WSGI section is right > on top. I'm posting everything anyway. > While testing I've used a <Directory "/var/www/modwsgi/gatekeeper/ > public/images"> directive and I was able to browse the images folder > so I guess everything is fine here. Or isn't?.. > > # ----- vhost begin ----- > > Listen 50000 > > <IfDefine SSL> > <IfModule mod_ssl.c> > ## > ## SSL Virtual Host Context > ## > <VirtualHost *:50000> > > # General setup for the virtual host > ServerName gatekeeper.localhost > ServerAdmin ad...@localhost > DocumentRoot /var/www/modwsgi/gatekeeper > > WSGIScriptAlias / /var/www/modwsgi/gatekeeper/gatekeeper.wsgi > Alias /images /var/www/gatekeeper/public/images > Alias /css /var/www/gatekeeper/public/css > Alias /files /var/www/gatekeeper/public/files > Alias /js /var/www/gatekeeper/public/js > > WSGIDaemonProcess gatekeeper threads=10 processes=3 > WSGIProcessGroup gatekeeper > WSGIPassAuthorization On > > LogLevel debug > > ErrorLog /var/log/apache2/ssl_error_log > <IfModule mod_log_config.c> > TransferLog /var/log/apache2/ssl_access_log > </IfModule> > > # SSL Engine Switch: > # Enable/Disable SSL for this virtual host. > SSLEngine on > SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW: > +SSLv2:+EXP:+eNULL > SSLCertificateFile /etc/ssl/apache2/gatekeeper/server.crt > SSLCertificateKeyFile /etc/ssl/apache2/gatekeeper/server.pem > SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean- > shutdown > > <Files ~ "\.(cgi|shtml|phtml|php?)$"> > SSLOptions +StdEnvVars > </Files> > > <IfModule mod_setenvif.c> > SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean- > shutdown \ > downgrade-1.0 force-response-1.0 > </IfModule> > > # Per-Server Logging: > # The home of a custom SSL log file. Use this when you want > a > # compact non-error SSL logfile on a virtual host basis. > <IfModule mod_log_config.c> > CustomLog /var/log/apache2/ssl_request_log \ > "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" > </IfModule> > > <IfModule mod_rewrite.c> > RewriteEngine On > RewriteOptions inherit > </IfModule> > > <Directory "/var/www/gatekeeper"> > Order allow,deny > Allow from all > #Allow from 10.17.1.0/24 > </Directory> > > <Directory "/var/www/modwsgi/gatekeeper"> > Order allow,deny > Allow from all > #Allow from 10.17.1.0/24 > </Directory> > > </VirtualHost> > > </IfModule> > </IfDefine> > > # ----- vhost end ----- > > Thanks Carl and Graham for taking your time to look at this. I'm now > spending more time trying to deploy the app than building it :/ > > Vitor (noisebleed) > > On 21 Abr, 14:41, Carl Nobile <carl.nob...@gmail.com> wrote: >> Vitor, >> >> It surely seems the problem is related to not finding a URL correctly. >> What does your apache config look like? You should only have a few >> lines as mod_wsgi doesn't really need too much in the way of >> configuration. >> >> ~Carl >> >> On Wed, Apr 21, 2010 at 9:08 AM, noisebleed <vitorbrandao...@gmail.com> >> wrote: >> > Hi again. >> >> > First, thanks for the insight about these deployment issues. >> >> > About your suggestion now Apache is throwing 404 Not Found instead of >> > 500 Internal Server Error and I see something like this in the log: >> > [error] 14:28:12,102 DEBUG [tg.controllers] No controller-wide >> > authorization at / >> > [error] 14:28:12,105 DEBUG [pylons.controllers.core] Merging >> > pylons.response headers into start_response call, status: 404 Not >> > Found >> > [error] 14:28:12,108 DEBUG [txn.-1333920912] commit >> > [error] 14:28:12,109 DEBUG [tg.configuration] Removing DBSession from >> > current thread >> >> > Any ideas? >> >> > Vitor (noisebleed) >> >> > On 21 Abr, 13:45, Graham Dumpleton <graham.dumple...@gmail.com> wrote: >> >> On 21 April 2010 22:34, noisebleed <vitorbrandao...@gmail.com> wrote: >> >> >> > Hi Graham. >> >> >> > I'm not sure what should I post about your "URL mapping" question. >> >> > I've searched the application and found nothing really useful. I do >> >> > know that TG2 is based on Pylons so I guess it uses the Pylons way. >> >> >> > Don't know if it helps but the same app is working with "paster serve" >> >> > on the personal machine. To test it I'm usinghttp://localhost:8080. >> >> >> > Sorry for my lack of knowledge but I'm fairly new to web development >> >> > in Python. >> >> >> It isn't your fault. The problem is that 'paster serve' does >> >> additional setup of the process environment and application beyond >> >> what 'loadapp' by itself does. Given that recipes for using an >> >> alternate WSGI server often only talk about loadapp and not what else >> >> has to be done, you cant replicate the setup in the same way and this >> >> is why you get differences like you are encountering between paste >> >> server and other hosting methods. Same sort of problem occurs in other >> >> frameworks as well when trying to move from their builtin development >> >> servers to other hosting mechanism. It all really sucks and the base >> >> framework developers seem to not usually care much about making it >> >> easier by providing single object entry points that do everything that >> >> the internal web servers do. >> >> >> That said, TG setup instructions I have seen have been reasonably good >> >> at capturing these extra hidden steps. The question is why one of >> >> these steps they note, which is the app.get() isn't working. >> >> >> Can you perhaps try: >> >> >> app.get("") >> >> >> and see if it makes a difference. It may be something to do with >> >> trailing slash where something is handling single slash differently. >> >> >> Graham >> >> >> > If you have suggestion for debugging this issue I would be glad to try >> >> > it. >> >> >> > Regards, >> >> > Vitor (noisebleed) >> >> >> > On 21 Abr, 03:29, Graham Dumpleton <graham.dumple...@gmail.com> wrote: >> >> >> On 21 April 2010 00:42, noisebleed <vitorbrandao...@gmail.com> wrote: >> >> >> >> > Hi all. First message sent to modwsgi mailing list. >> >> >> >> > I've built a small web application with TurboGears2 and tested it >> >> >> > inside a virtualenv (on my personal machine) with "paster serve >> >> >> > development.ini". Works just fine. >> >> >> >> > Then I built an Egg and installed system-wide on my server. Defined a >> >> >> > new Apache2 vhost and configured both Apache and the wsgi script >> >> >> > created by modwsgideploy. After some adjustments I'm stuck with the >> >> >> > message in the email subject. When visiting my URL Apache shows "500 >> >> >> > Internal Server Error". >> >> >> >> > Here goes an excerpt from Apache error log: >> >> >> >> > [info] Initial (No.1) HTTPS request received for child 1 (server >> >> >> > gatekeeper.localhost:443) >> >> >> > [info] mod_wsgi (pid=21618): Create interpreter >> >> >> > 'gatekeeper.localhost: >> >> >> > 50000|'. >> >> >> > [info] [client 192.168.1.103] mod_wsgi (pid=21618, >> >> >> > process='gatekeeper', application='gatekeeper.localhost:50000|'): >> >> >> > Loading WSGI script '/var/www/modwsgi/gatekeeper/ >> >> >> > gatekeeper.wsgi'. >> >> >> > [error] 15:54:44,649 DEBUG [pylons.configuration] Initializing >> >> >> > configuration, package: >> >> >> > 'gatekeeper' >> >> >> > [error] 15:54:44,651 DEBUG [pylons.configuration] Pushing process >> >> >> > configuration >> >> >> > [error] 15:54:44,681 DEBUG [pylons.configuration] Adding mako engine >> >> >> > with alias None and {'mako.directories': ['/usr/lib/python2.6/site- >> >> >> > packages/GateKeeper-0.1dev-py2.6.egg/gatekeeper/templates'], >> >> >> > 'myghty.component_root': [{'templates': '/usr/lib/python2.6/site- >> >> >> > packages/GateKeeper-0.1dev-py2.6.egg/gatekeeper/templates'}], >> >> >> > 'myghty.data_dir': '/var/www/modwsgi/gatekeeper/data/templates', >> >> >> > 'kid.encoding': 'utf-8', 'kid.assume_encoding': 'utf-8', >> >> >> > 'mako.module_directory': >> >> >> > '/var/www/modwsgi/gatekeeper/data/templates', >> >> >> > 'myghty.allow_globals': ['c', 'config', 'g', 'h', 'render', >> >> >> > 'request', >> >> >> > 'session', 'translator', 'ungettext', '_', 'N_'], >> >> >> > 'myghty.output_encoding': 'utf-8', 'myghty.raise_error': True, >> >> >> > 'mako.output_encoding': 'utf-8', 'mako.filesystem_checks': True} >> >> >> > options >> >> >> > [error] 15:54:44,682 DEBUG [pylons.configuration] Loaded mako >> >> >> > template >> >> >> > engine as the default template >> >> >> > renderer >> >> >> > [error] 15:54:44,931 DEBUG [pylons.templating] Initialized Buffet >> >> >> > object >> >> >> > [error] 15:54:44,933 DEBUG [pylons.templating] Adding mako template >> >> >> > language for use with >> >> >> > Buffet >> >> >> > [error] 15:54:44,934 DEBUG [routes.middleware] Initialized with >> >> >> > method >> >> >> > overriding = True, and path info altering = >> >> >> > True >> >> >> > [error] 15:54:45,025 DEBUG [txn.-1335477392] new >> >> >> > transaction >> >> >> > [error] 15:54:45,035 DEBUG [routes.middleware] Matched >> >> >> > GET / >> >> >> > [error] 15:54:45,036 DEBUG [routes.middleware] Route path: '*url', >> >> >> > defaults: {'action': u'routes_placeholder', 'controller': >> >> >> > u'root'} >> >> >> > [error] 15:54:45,037 DEBUG [routes.middleware] Match dict: {'url': >> >> >> > u'/', 'action': u'routes_placeholder', 'controller': >> >> >> > u'root'} >> >> >> > [error] 15:54:45,038 DEBUG [pylons.wsgiapp] Setting up Pylons stacked >> >> >> > object >> >> >> > globals >> >> >> > [error] 15:54:45,040 DEBUG [pylons.wsgiapp] Setting up paste testing >> >> >> > environment >> >> >> > variables >> >> >> > [error] 15:54:45,041 DEBUG [pylons.wsgiapp] Resolved URL to >> >> >> > controller: >> >> >> > u'root' >> >> >> > [error] 15:54:45,088 DEBUG [tw.core.resources] Registered static at / >> >> >> > tw.forms/ >> >> >> > static >> >> >> > [error] 15:54:45,092 DEBUG [tw.core.resources] Registered static/ >> >> >> > calendar at /tw.forms/static/ >> >> >> > calendar >> >> >> > [error] 15:54:45,183 DEBUG [tg.wsgiapp] Found controller, module: >> >> >> > 'gatekeeper.controllers.root', class: >> >> >> > 'RootController' >> >> >> > [error] 15:54:45,184 DEBUG [pylons.wsgiapp] Controller appears to be >> >> >> > a >> >> >> > class, instantiating >> >> >> >> > (...) >> >> >> >> > [error] 15:54:45,192 INFO [tg.i18n] Set request language to >> >> >> > [] >> >> >> > [error] 15:54:45,194 INFO [tg.i18n] Language []: not supported by >> >> >> > FormEncode >> >> >> > [error] 15:54:45,195 DEBUG [tg.controllers] No controller-wide >> >> >> > authorization >> >> >> > at / >> >> >> > [error] 15:54:45,198 DEBUG [pylons.controllers.core] Merging >> >> >> > pylons.response headers into start_response call, status: 404 Not >> >> >> > Found >> >> >> > [error] 15:54:45,201 DEBUG [txn.-1335477392] >> >> >> > commit >> >> >> > [error] 15:54:45,202 DEBUG [tg.configuration] Removing DBSession from >> >> >> > current >> >> >> > thread >> >> >> > [error] 15:54:45,203 DEBUG [txn.-1335477392] new >> >> >> > transaction >> >> >> > [error] 15:54:45,208 DEBUG [routes.middleware] Matched GET /error/ >> >> >> > document >> >> >> > [error] 15:54:45,209 DEBUG [routes.middleware] Route path: '*url', >> >> >> > defaults: {'action': u'routes_placeholder', 'controller': >> >> >> > u'root'} >> >> >> > [error] 15:54:45,210 DEBUG [routes.middleware] Match dict: {'url': >> >> >> > u'/ >> >> >> > error/document', 'action': u'routes_placeholder', 'controller': >> >> >> > u'root'} >> >> >> > [error] 15:54:45,211 DEBUG [pylons.wsgiapp] Setting up Pylons stacked >> >> >> > object >> >> >> > globals >> >> >> > [error] 15:54:45,212 DEBUG [pylons.wsgiapp] Setting up paste testing >> >> >> > environment >> >> >> > variables >> >> >> > [error] 15:54:45,214 DEBUG [pylons.wsgiapp] Resolved URL to >> >> >> > controller: >> >> >> > u'root' >> >> >> > [error] 15:54:45,215 DEBUG [pylons.wsgiapp] Controller appears to be >> >> >> > a >> >> >> > class, >> >> >> > instantiating >> >> >> > [error] 15:54:45,216 DEBUG [pylons.wsgiapp] Calling controller class >> >> >> > with WSGI interface >> >> >> >> > (...) >> >> >> >> > [error] 15:54:45,223 INFO [tg.i18n] Set request language to [] >> >> >> > [error] 15:54:45,225 INFO [tg.i18n] Language []: not supported by >> >> >> > FormEncode >> >> >> > [error] 15:54:45,226 DEBUG [tg.controllers] No controller-wide >> >> >> > authorization at /error/document >> >> >> > [error] 15:54:45,229 DEBUG [pylons.controllers.core] Merging >> >> >> > pylons.response headers into start_response call, status: 404 Not >> >> >> > Found >> >> >> > [error] 15:54:45,231 DEBUG [txn.-1335477392] commit >> >> >> > [error] 15:54:45,232 DEBUG [tg.configuration] Removing DBSession from >> >> >> > current thread >> >> >> > [error] [client 192.168.1.103] mod_wsgi (pid=21618): Target WSGI >> >> >> > script '/var/www/modwsgi/gatekeeper/gatekeeper.wsgi' cannot be loaded >> >> >> > as Python module. >> >> >> > [error] [client 192.168.1.103] mod_wsgi (pid=21618): Exception >> >> >> > occurred processing WSGI script '/var/www/modwsgi/gatekeeper/ >> >> >> > gatekeeper.wsgi'. >> >> >> > [error] [client 192.168.1.103] Traceback (most recent call last): >> >> >> > [error] [client >> >> ... >> >> mais informações » > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to modw...@googlegroups.com. > To unsubscribe from this group, send email to > modwsgi+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > > -- ------------------------------------------------------------------------------- Carl J. Nobile (Software Engineer) carl.nob...@gmail.com ------------------------------------------------------------------------------- -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to modw...@googlegroups.com. To unsubscribe from this group, send email to modwsgi+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.