Trying using:

  http://www.howsthe.com/blog/2009/sep/20/djang-nginx-mod_wsgi-ssl/

instead. My original email was ideas only and didn't necessarily mesh
properly with the requirements of specific frameworks and what they
expected for the magic headers.

Graham

On 25 January 2011 10:56, ckohrman <[email protected]> wrote:
> Sorry, I am still using nginx.  Since I'm a little new at this, I'll
> include the entire nginx conf:
>
>        server_name www.mydomain.com mydomain.com;
>        # Redirect for mydomain.com
>        # Required for certificate www.mydomain.com
>        if ($host = 'mydomain.com' ) {
>                rewrite ^/(.*)$ https://www.mydomain.com/$1 permanent;
>        }
> # @# 1/24/2011 CK Add line for Django handling
>        proxy_set_header X-Url-Scheme $scheme;
>
>           location / {
>                client_max_body_size    10m;
>                client_body_buffer_size 128k;
>
>                proxy_send_timeout   90;
>                proxy_read_timeout   90;
>
>                proxy_buffer_size    4k;
>                # you can increase proxy_buffers here to suppress "an
> upstream response
>                #  is buffered to a temporary file" warning
>                proxy_buffers     16 32k;
>                proxy_busy_buffers_size 64k;
>                proxy_temp_file_write_size 64k;
>
>                proxy_connect_timeout 30s;
>
>                #proxy_redirect  http://mydomain.com:81   http://mydomain.com;
>
>                proxy_pass   http://98.158.188.132:81/;
>
>                proxy_set_header        Host    $host;
>                proxy_set_header        X-Real-IP       $remote_addr;
>                proxy_set_header        X-Forwarded-For
> $proxy_add_x_forwarded_for;
>                proxy_set_header        X-Forwarded-Protocol
> "https";
>        }
>
>
> }
>
> # redirects
> # 12/5/2010 JG Redirect for mydomain2.com and www.mydomain2.com
> server {
>        access_log off;
>        error_log  /var/log/nginx/vhost-error_log warn;
>        listen    80;
>        listen    443;
>        server_name  mydomain2.com www.mydomain2.com;
>        location / {
>                rewrite ^ http://mydomain.com/blog permanent;
>        }
> }
> # Redirection for wrong name spelling
> server {
>
> Working on figuring out the debugging techniques now.
>
> Thanks,
> Chip
>
>
> On Jan 24, 6:14 pm, Graham Dumpleton <[email protected]>
> wrote:
>> On 25 January 2011 08:48, ckohrman <[email protected]> wrote:
>>
>>
>>
>> > Update: I've changed application to _application, and added tabs to
>> > the last two lines:
>>
>> > import os, sys
>> > sys.stdout = sys.stderr
>> > sys.path.insert(1,'/home/mydomain/www/mydomain.com/')
>> > sys.path.insert(2,'/home/mydomain/www/mydomain.com/mydomainmain/')
>> > os.environ['DJANGO_SETTINGS_MODULE'] = 'mydomainmain.settings'
>> > os.environ['PYTHON_EGG_CACHE'] = '/home/mydomain/www/
>> > mydomain.com/.python-eggs'
>> > import django.core.handlers.wsgi
>> > application = django.core.handlers.wsgi.WSGIHandler()
>>
>> > import mydomainmain.monitor
>> > mydomainmain.monitor.start(interval=1.0)
>>
>> > def application(environ, start_response):
>> > environ['wsgi.url_scheme'] = environ.get('HTTP_X_URL_SCHEME', 'http')
>>
>> You don't say whether you are setting this one in nginx. Post the
>> relevant parts of the nginx configuration.
>>
>> You can use first test application in:
>>
>>  http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Displaying_...
>>
>> to see what is coming through in WSGI request environ dictionary.
>>
>> Graham
>>
>> > return _application(environ, start_response)
>>
>> > No internal server error anymore, but django error message says I have
>> > a KeyError for 'HTTP_X_FORWARDED_HOST'.  I'm going from an http page
>> > to a payment ui that should be https.
>>
>> > Chip
>>
>> > On Jan 24, 4:11 pm, ckohrman <[email protected]> wrote:
>> >> I came across Graham's solution to get https to work with mod_wsgi,
>> >> nginx, and 
>> >> django:http://groups.google.com/group/modwsgi/browse_frm/thread/94f952720c87...
>>
>> >> I added this line to nginx vhost.conf:
>> >> proxy_set_header X-Proxy-Host $proxy_host;
>>
>> >> But I got an Internal Server Error message when I added the code to my
>> >> wsgi file.  If you have a second, could you please skim my wsgi entry
>> >> for any obvious error:
>>
>> >> import os, sys
>> >> sys.stdout = sys.stderr
>> >> sys.path.insert(1,'/home/mydomain/www/mydomain.com/')
>> >> sys.path.insert(2,'/home/mydomain/www/mydomain.com/mydomainmain/')
>> >> os.environ['DJANGO_SETTINGS_MODULE'] = 'mydomainmain.settings'
>> >> os.environ['PYTHON_EGG_CACHE'] = '/home/mydomain/www/
>> >> mydomain.com/.python-eggs'
>> >> import django.core.handlers.wsgi
>> >> application = django.core.handlers.wsgi.WSGIHandler()
>>
>> >> import mydomainmain.monitor
>> >> mydomainmain.monitor.start(interval=1.0)
>>
>> >> def application(environ, start_response):
>> >> environ['wsgi.url_scheme'] = environ.get('HTTP_X_URL_SCHEME', 'http')
>> >> return _application(environ, start_response)
>>
>> >> I'm lost, and I'd appreciate any help you can offer.
>>
>> >> Apache/2.2.15 (Unix)
>> >> mod_ssl/2.2.15
>> >> OpenSSL/0.9.8e-fips-rhel5
>> >> mod_wsgi/3.3
>> >> Python/2.7
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "modwsgi" 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 
>> > athttp://groups.google.com/group/modwsgi?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" 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/modwsgi?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" 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/modwsgi?hl=en.

Reply via email to