![](/img/trans.png)
[英]Django - Deployment with Gunicorn, Nginx and Supervisor, Gunicorn error log
[英]Django deployment https + gunicorn and nginx
我堅持用nginx和gunicorn在aws上用django設置https。
我的配置是:
server {
listen 80;
listen 443 ssl;
server_name logitech.enterpriselist.com;
rewrite ^ https://logitech.enterpriselist.com$request_uri? permanent;
root /home/ubuntu/git/elist/static/;
#` ssl on;
ssl_certificate /etc/ssl/elist.crt;
ssl_certificate_key /etc/ssl/elist.key;
location / {
# proxy_pass http://logitech.enterpriselist.com/;
}
location /static/ {
alias /home/ubuntu/git/elist/static/;
}
}
使用端口8001
http可以正常工作:
gunicorn configs.wsgi:application --bind 172.31.14.102:8001`
而不是域http://logitech.enterpriselist.com:8001/
。
但是我也想使用默認端口運行東西,但是當我運行時
gunicorn configs.wsgi:application --bind 172.31.14.102:80
它說地址已經被使用了!
當我打開http://logitech.enterpriselist.com/
,也使用https,它會轉到https://logitech.enterpriselist.com/
但是它說網站具有重定向循環,因此我需要幫助進行排序。
您什么都沒有告訴nginx應該將請求代理到gunicorn。 特別是,您需要proxy_pass
指令和upstream
部分。
另外,您也不想在端口80上運行gunicorn,因為那是nginx已經綁定到的端口。 這就是代理的目的。
gunicorn部署文檔有一個可以正常運行的示例nginx配置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.