简体   繁体   English

使用没有 proxy_pass 的 Nginx 服务 Django 站点

[英]Serve Django site using Nginx without proxy_pass

I have done the nginx configuration for serving django app.i am able to serve the django site using proxy pass for that i have to run the server manualy and then nginx serves the site.I want to execute the site using nginx but the server should get start automaticaly it shoud not be go through proxy_pass is this possible.please suggest some solution. I have done the nginx configuration for serving django app.i am able to serve the django site using proxy pass for that i have to run the server manualy and then nginx serves the site.I want to execute the site using nginx but the server should通过proxy_pass自动启动它不应该是go是可能的。请提出一些解决方案。

Thanks....谢谢....

I think the problem here is that you try to serve your development server through nginx;我认为这里的问题是您尝试通过 nginx 为您的开发服务器提供服务; That's not what it's for, it's for development purposes only.这不是它的用途,它仅用于开发目的。

To set up a production server you could use要设置生产服务器,您可以使用

Both gunicorn and apache are very stable in production environments if used correctly, these are my experiences though.如果使用得当,gunicorn 和 apache 在生产环境中都非常稳定,不过这些都是我的经验。

You don't state your OS, so... having deployed django behind both apache and nginx in Windows , I have to say that I found nginx to be infinitely easier. You don't state your OS, so... having deployed django behind both apache and nginx in Windows , I have to say that I found nginx to be infinitely easier. However, since nginx is more of a static file server with excellent proxying capability, I ran a separate wsgi server for the django app.但是,由于 nginx 更像是 static 文件服务器,具有出色的代理功能,因此我为 django 应用程序运行了一个单独的 wsgi 服务器。 After trying several (and finding they were unix-only), I found CheryPy's wsgi server (which can be used independently of rest of CherryPy) to work just fine (and it's pretty fast, to boot).在尝试了几个(并且发现它们仅适用于 unix)之后,我发现 CheryPy 的 wsgi 服务器(可以独立于 CherryPy 的 rest 使用)工作得很好(而且它的启动速度非常快)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM