![](/img/trans.png)
[英]After configure Django with Postgres, Nginx, and Gunicorn on CentOS 8,no matter how i change the Django ,there has no change
[英]How to configure nginx for django with gunicorn?
我已成功运行 gunicorn 并确认我的网络在 localhost:8000 上运行。 但我无法正确使用 nginx。 我的配置文件是这样的:
server {
listen 80;
server_name 104.224.149.42;
location / {
proxy_pass http://127.0.0.1:8000;
}
}
104.224.149.42是外界的ip。
做这个
/etc/nginx/sites-enabled/default
删除default
/etc/nginx/sites-enabled/default
使用以下内容创建/etc/nginx/sites-available/my.conf
server {
listen 80;
server_name 104.224.149.42;
location / {
proxy_pass http://127.0.0.1:8000;
}
}
然后sudo ln -s /etc/nginx/sites-available/my.conf /etc/nginx/sites-enabled/my.conf
nginx
您必须配置static
文件和media
文件服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.