> On 14 May 2018, at 4:09 pm, Jorge Macias <[email protected]> wrote:
>
> Hi. Im using turbogears with python 3.5.2 and apache 2.4.18 in ubuntu 16.04
> I compiled python with --enable-shared option also I compiled mod_wsgi
> 4.6.4 and i checked with ldd mod_wsgi.so that the library is ok.
> Everything works ok. But when the user enters a secure route the app fails to
> authenticate.
What do you mean by secure route? Do you just mean using HTTP Basic of Digest
Authentication? Your Apache configuration doesn't show a VirtualHost for secure
HTTPS connections.
> The passwords are located in a text file called passwd_file (Turbogears
> example)
>
> So i follow Graham recommendation to use WSGIPassAuthorization to pass the
> control to the wsgi app.
>
> My apache tg2.conf as follows:
> Enter code here...
Best to disable embedded mode by adding:
WSGIRestrictEmbedded On
> <VirtualHost *:8080>
>
> ServerName sun
>
>
> WSGIPassAuthorization On
>
>
> WSGIProcessGroup sun
>
>
> WSGIDaemonProcess sun user=wsgi group=wsgi threads=4
> python-path=/home/wsgi/public_wsgi/.virtualenvs/tg2env/lib/python3.5/site-packages
>
>
Better to use:
WSGIDaemonProcess sun user=wsgi group=wsgi threads=4 \
python-home=/home/wsgi/public_wsgi/.virtualenvs/tg2env
> WSGIScriptAlias / /home/wsgi/public_wsgi/python.sun/app.wsgi
>
>
> <Location />
>
>
> WSGIPassAuthorization On
>
>
> </Location>
>
>
This WSGIPassAuthorization in Location block is redundant as have it above at
top level scope.
> #Serve static files directly without TurboGears
>
>
> Alias /images /home/wsgi/public_wsgi/python.sun/pythonsun/public/images
>
>
> Alias /css /home/wsgi/public_wsgi/python.sun/pythonsun/public/css
>
>
> Alias /js /home/wsgi/public_wsgi/python.sun/pythonsun/public/js
>
>
> <Directory /home/wsgi/public_wsgi/python.sun/>
>
>
> WSGIProcessGroup sun
>
>
This is redundant as have it above at top level scope.
> WSGIApplicationGroup %{GLOBAL}
>
>
Instead of using WSGIProcessGroup and WSGIApplicationGroup, can be better to
use WSGIScriptAlias as:
WSGIScriptAlias / /home/wsgi/public_wsgi/python.sun/app.wsgi \
process-group=sun application-group=%{GLOBAL}
> WSGIScriptReloading On
>
>
Script reloading is on by default, you don't need this.
> Require all granted
>
>
> </Directory>
>
>
> ErrorLog ${APACHE_LOG_DIR}/error.log
>
>
> CustomLog ${APACHE_LOG_DIR}/access.log combined
>
>
> </VirtualHost>
>
>
> WSGIPythonHome /home/wsgi/public_wsgi/.virtualenvs/tg2env
>
>
> WSGIPythonPath /home/wsgi/public_wsgi/.virtualenvs/tg2env/lib/python3.5
>
>
You don't need WSGIPythonHome here if set it on WSGIDaemonProcess using
python-home and disable embedded mode using WSGIRestrictEmbedded.
The path for WSGIPythonPath appears to be wrong and would be ignored since
using daemon mode so can drop this as well.
> Can any one help me what i missing here?
> I would appreciate any help.
So those changes clean up your configuration, but aren't a source of any
specific problem.
>From the information you have given, it isn't really possible to understand
>what may be going wrong. Are you always getting 401, or perhaps a 403? Is
>anything logged? If you are using a text file for passwords, is that file
>readable by the user that Apache is running your code, as well as all the
>directories down to that file?
Graham
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.