Without knowing exactly what you tried, it’s hard to give you a very detailed answer, but hopefully this points you in the right direction.
A Nginx reverse proxy configuration would normally look something like this:
upstream app_server {
server 127.0.0.1:9000 fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
index index.html index.htm;
client_max_body_size 4G;
server_name example.com;
keepalive_timeout 5;
location /static {
root /path/to/staric/files;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
}
Though if you are using Mezzanine, you might want to consider using Fabric to handle your deployment needs. Each Mezzanine project should come with a fabfile.py
that will automate setting up a stanadrd Nginx/Gunicorn/Postgres stack. Check out the Mezzanine docs.
Youll need to add some server specific configurable variables in the project’s settings.py
module. Here’s an example:
FABRIC = {
"SSH_USER": "", # SSH username for host deploying to
"HOSTS": ALLOWED_HOSTS[:1], # List of hosts to deploy to (eg, first host)
"DOMAINS": ALLOWED_HOSTS, # Domains for public site
"REPO_URL": "ssh://hg@bitbucket.org/user/project", # Project's repo URL
"VIRTUALENV_HOME": "", # Absolute remote path for virtualenvs
"PROJECT_NAME": "", # Unique identifier for project
"REQUIREMENTS_PATH": "requirements.txt", # Project's pip requirements
"GUNICORN_PORT": 8000, # Port gunicorn will listen on
"LOCALE": "en_US.UTF-8", # Should end with ".UTF-8"
"DB_PASS": "", # Live database password
"ADMIN_PASS": "", # Live admin user password
"SECRET_KEY": SECRET_KEY,
"NEVERCACHE_KEY": NEVERCACHE_KEY,
}