2016-02-23 19 views
5

Quando avvio il servizio Gunicorn, attualmente utilizzo questo comando per avviarlo: gunicorn --certfile =/Projects/thebodyofchrist.us.crt --keyfile =/Projects/thebodyofchrist. us.key bodyofchrist.wsgi -b 0.0.0.0:443 -b 0.0.0.0:80 -w 10Esecuzione di Gunicorn su entrambi http e https

Per collegare gunicorn sia a http che a https - o setup apache2 per ascoltare http e reindirizzare le richieste a https con parametri esistenti. Ho centinaia di link al http://domain.com/sample/request e la necessità di andare automaticamente https://domain.com/sample/request

gunicorn ospita Django.

Grazie per qualsiasi aiuto!

risposta

1

Gunicorn è un progetto molto solido, spero che costruiscono fuori un giorno con il legame porta multipla e riga di comando per indicare la precedenza SSL.

Quando si entra in produzione, si vorrà utilizzare il bilanciamento del carico superiore di Apache o Nginx.

Ma nulla impedisce (durante lo sviluppo) di eseguire alcuni lavoratori legati alla porta 80 e alcuni lavoratori legati alla porta 443 con set di file chiave e certfile. Potresti quindi scrivere il link di accesso come URL "assoluto", ad es. href = "https: // yoursite/login" dopo il login, avrebbero usato gli URL https.

#!/bin/sh 
# put 8 workers as Daemon listening for HTTPS on 443 
gunicorn -D -w 8 --certfile=/Projects/thebodyofchrist.us.crt --keyfile=/Projects/thebodyofchrist.us.key bodyofchrist.wsgi -b 0.0.0.0:443 

# put 2 workers as Daemon listening for HTTP on port 80 
gunicorn -D -w 2 bodyofchrist.wsgi -b 0.0.0.0:80 
Problemi correlati