I'm trying to use Graham Dumpleton's instructions for setting this up
and I don't know what I'm doing wrong. Are there complete instructions
for this i.e., starting from apache then nginx? I have apache
listening on 8080 and have nginx setup to proxy requests on ports 80
and 443 via the upstream directive. I keep getting this error:

"Firefox has detected that the server is redirecting the request for
this address in a way that will never complete."

For some reason my MEDIA_ROOT won't resolve even though it's the same
path I used when apache was handling all requests i.e., the MEDIA_ROOT
path in my project settings is exactly the same as the location
defined in my nginx vhost file, which is the same as what I had
defined in my apache vhost file.

Also, my wsgi file is located in the django
project folder, which is located inside domain.com, which is in turn
located inside public_html. Is this correct, because if I don't type
out the full path for sys.path.append my settings file is not found.
Thanks for any assistance.


### /public_html/domain.com/domain/domain.wsgi ###
import os, sys

# apache_configuration = os.path.dirname(__file__)
# project = os.path.dirname(apache_configuration)
# workspace = os.path.dirname(project)
# sys.path.append(workspace)

sys.path.append('/home/user/public_html/domain.com/')

os.environ['DJANGO_SETTINGS_MODULE'] = 'domain.settings'

import django.core.handlers.wsgi

_application = django.core.handlers.wsgi.WSGIHandler()

def application(environ, start_response):
    environ['wsgi.url_scheme'] = environ.get('HTTP_X_URL_SCHEME',
'http')
    return _application(environ, start_response)

### /etc/nginx/nginx.conf ###

user www-data www-data;
worker_processes  4;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;

}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    access_log  /var/log/nginx/access.log;

    sendfile        on;
    tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  3;
    #tcp_nodelay        on;

    gzip  on;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_types      text/plain text/html text/css application/x-
javascript text/xml application/xml
    application/xml+rss text/javascript;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
    proxy_set_header X-Url-Scheme $scheme;

}

### /etc/nginx/sites-available/domain.com ###

upstream domain {
    server         127.0.0.1:8080;

}

# This can be used to redirect example.com to www.example.com
#server {
    #server_name  domain.com;
    #rewrite ^(.*) http://www.domain.com$1 permanent;
#}

server {
    listen   80;
    server_name  domain.com;

    location / {
        proxy_pass  http://domain;
    }

    # Link your media to server static content
    location /site_media {
        root    /home/user/public_html/domain.com/site_media/;
        # This would be set to whatever is in your setting.MEDIA_ROOT.
    }

    location /admin_media {
        root    /home/user/public_html/domain.com/admin_media/;
        # This would be set to whatever is in your setting.MEDIA_ROOT.
    }

}

server {
    listen 443;
    server_name  domain.com;

    ssl on;
    ssl_certificate /etc/ssl/certs/domain.crt; # Specify the location
of the cert
    ssl_certificate_key /etc/ssl/private/domain.key; # Specify the
location of the private key
    ssl_prefer_server_ciphers    on;

    location / {
        proxy_pass    http://domain;
    }
    location /site_media {
        root    /home/user/public_html/domain.com/site_media/;
        # This would be set to whatever is in your setting.MEDIA_ROOT.
    }

    location /admin_media {
        root    /home/user/public_html/domain.com/admin_media/;
        # This would be set to whatever is in your setting.MEDIA_ROOT.
    }

}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Satchmo users" 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/satchmo-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to