You should use a user and group that are not apache. I usually put
each project in a different user and group so I know exactly which
processes and threads are running for a specific project.

Below is a link I found that may help.

http://getmediacore.com/blog/turbogears-2-tg2-with-mod_wsgi-and-virtual-environments/

~Carl

On Wed, Apr 21, 2010 at 11:12 AM, noisebleed <vitorbrandao...@gmail.com> wrote:
> I hope so ;)
>
> Updated the vhost file according to your suggestions.
>
> - DocumentRoot /var/www/modwsgi/gatekeeper
>
> - WSGIDaemonProcess gatekeeper threads=10 processes=3
> + WSGIDaemonProcess gatekeeper user=apache group=apache processes=3
> threads=10 maximum-requests=1000
> WSGIProcessGroup gatekeeper
>
> The docs are really good and I've checked FAQ and the configuration
> docs but I'm still searching for that little magic trick that will put
> this app flying...
>
> Vitor (noisebleed)
>
> In the meanwhile I've installed TG2 in the server (virtualenv), built
> the quickstart project (named to GateKeeper/gatekeeper), changed
> gatekeeper.wsgi to read from virtualenv but the results are the same.
> Paster serve works here too...
>
> On 21 Abr, 15:28, Carl Nobile <carl.nob...@gmail.com> wrote:
>> 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',
>>
>> ...
>>
>> 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.

Reply via email to