On 25/01/2008, Lukasz Szybalski <[EMAIL PROTECTED]> wrote:
> > In mod_wsgi, if you want Apache to serve up static files instead, so
> > that things are more effecient, then would use:
> >
> > Alias /static /some/path/to/dir/static
> >
> > <Directory /some/path/to/dir/static>
> > Order Allow,Deny
> > Allow from All
> > </Directory>
> >
> > The Alias directive should appear before the WSGIScriptAlias directive
> > in the Apache configuration.
> >
> > That directory and the files in it would need to be readable to user
> > that Apache runs as.
> > For more about static file serving see section 'Hosting Of Static Files' of:
> >
> > http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines
> >
> > It would be a good idea to read through the whole of that document as
> > explains various other configurations as well and may help to explain
> > things a bit better if you haven't already read it.
>
> I read over the documentation but it seemed to much at one time so
> these emails are really helping me to get the whole picture on
> mod_wsgi configuration.
>
> Lets talk folders.
> - It seems as /var/www/myfirstapp is an optimal solution for folder choice.
Having the WSGI script file at least within a directory known to
Apache is necessary. This can be the main Apache document tree or some
other directory provided that configuration for Apache is made to know
about the directory.
> - Since egg deploy puts stuff in python2.4/site-package it doesn't
> seems as moving turbogears app via egg is fisable unless there is a
> tg/egg command that I can specify which will allow me either
> easy_install in /var/www/myfirstapp or to put my tg app in
> /var/www/myfirstapp folder.
Don't know much about egging TG applications so can't comment.
> - I also put myfirstapp.wsgi in /var/www/myfirstapp/myfirstapp.wsgi
> -Prod.cfg in /var/www/myfirstapp/prod.cfg
One would have to be careful about putting TG configuration there,
especially if it contains sensitive information such as database
passwords. The reason is that a misconfiguration of Apache could
result in the configuration file being downloadable by people thereby
exposing the sensitive information.
So, much better that the ONLY thing in the directory known to Apache
is the WSGI script file and possibly any static files.
> - The actual app is in /var/www/myfirstapp/myfirstapp/
Same issues as configuration file. You really want to not be placing
your main application Python code in the directory known to Apache.
The only exception is the WSGI script file which bridges to the
totally different location outside of the Apache document directories.
> - Static content is in /var/wwww/myfirstapp/myfirstapp/static
Reasonable.
> - Server.log is also in /var/www/myfirstapp/server.log (I am not sure
> if this will be needed since I will be able to use apache logs to
> monitor my app? Correct?) (If that is the case who knows how to
> disable tg logs?)
As with configuration files and main application Python code, don't
put logs in document tree as misconfiguration could result in it being
able to be downloaded, thus revealing sensitive information.
As to disabling logging, the config option:
turbogears.config.update({'global': {'server.log_to_screen': False}})
in WSGI script file should disable various TG logging so am not sure
where you log file comes into it. What is the option on configuration
where you are defining it? Maybe you shouldn't be defining that
configuration option to begin with.
> Apache config:
> ----
> Alias /static /var/www/myfirstapp/myfirstapp/static
> WSGIScriptAlias /myfirstapp /var/www/myfirstapp/myfistapp.wsgi
>
> <Directory /var/www/myfirstapp/myfirstapp >
> Order deny,allow
> Allow from all
> </Directory>
> ------
> Permissions for /var/www/myfirstapp would be apache user permissions
> (www-data)
>
> -Does this folder structure sounds resonable?
Still recommend that only thing in /var/www should be the WSGI script
file. Don't put configuration files, log files or main Python
application code/egg in that directory.
> -Now I run into problem where my app www.example.com/myfirstapp has a
> login link that points to www.example.com/login How do I tell tg or
> wsgi to use www.example.com/myfirstapp/login?
Possibly see:
http://code.google.com/p/modwsgi/wiki/IntegrationWithTurboGears
it talks in there about mounting TG application on subURL of site.
Look for:
http://code.google.com/p/modwsgi/wiki/IntegrationWithTurboGears
and the WSGI application wrapper to do SCRIPT_NAME fiddles.
> - What would be a apache/wsgi config for having http://myfirstapp.example.com?
That is shown in referenced document above.
> - What would be the difference in wsgi and/or tg configuration for
> myfirstapp.example.com vs example.com/myfirstapp?
That is shown in reference document above.
Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---