nginx和gunicorn用于django项目

nginx和gunicorn用于django项目,django,nginx,Django,Nginx,大家好,我是django的新手,我很想知道如何与nginx和gunicorn一起为django项目设置类似的东西,谢谢 虚拟主机1 <VirtualHost *:80> ServerName project1.com ServerAlias www.project1.com ServerAdmin info@project1.com Alias /static/ /path/to/project1/project1/static/ Alias /media/ /path/to/pr

大家好,我是django的新手,我很想知道如何与nginx和gunicorn一起为django项目设置类似的东西,谢谢

虚拟主机1

<VirtualHost *:80>
ServerName project1.com
ServerAlias www.project1.com
ServerAdmin info@project1.com

Alias /static/ /path/to/project1/project1/static/
Alias /media/ /path/to/project1/project1/media/

ErrorLog   /path/to/project1/error.log
CustomLog /path/to/project1/access.log combined

WSGIDaemonProcess project1.com processes=2 threads=15 display-name=%{GROUP} python-path=/path/to/project1:/path/to/project1/local/lib/python2.7/site-packages
WSGIProcessGroup project1.com

WsgiScriptAlias / /path/to/project1/project1/wsgi.py

<Directory /path/to/project1/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

ServerName项目1.com
ServerAlias www.project1.com
服务器管理员info@project1.com
别名/static//path/to/project1/project1/static/
别名/media//path/to/project1/project1/media/
ErrorLog/path/to/project1/error.log
CustomLog/path/to/project1/access.log组合
WSGIDaemonProcess project1.com进程=2线程=15显示名称=%{GROUP}python路径=/path/to/project1:/path/to/project1/local/lib/python2.7/site-packages
WSGIProcessGroup项目1.com
WsgiScriptAlias//path/to/project1/project1/wsgi.py
命令允许,拒绝
通融
虚拟主机2

<VirtualHost *:80>
ServerName project2.com
ServerAlias www.project2.com
ServerAdmin info@project2.com

Alias /static/ /path/to/project2/project2/static/
Alias /media/ /path/to/project2/project2/media/

ErrorLog   /path/to/project2/error.log
CustomLog /path/to/project2/access.log combined

WSGIDaemonProcess project2.com processes=2 threads=15 display-name=%{GROUP} python-path=/path/to/project2:/path/to/project2/local/lib/python2.7/site-packages
WSGIProcessGroup project2.com

WsgiScriptAlias / /path/to/project2/project2/wsgi.py

<Directory /path/to/project2/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

ServerName项目2.com
ServerAlias www.project2.com
服务器管理员info@project2.com
别名/static//path/to/project2/project2/static/
别名/media//path/to/project2/project2/media/
ErrorLog/path/to/project2/error.log
CustomLog/path/to/project2/access.log组合
WSGIDaemonProcess project2.com进程=2线程=15显示名称=%{GROUP}python路径=/path/to/project2:/path/to/project2/local/lib/python2.7/site-packages
WSGIProcessGroup项目2.com
WsgiScriptAlias//path/to/project2/project2/wsgi.py
命令允许,拒绝
通融

看一看-这应该足以让您开始使用nginx和gunicorn。

嗨,William-欢迎使用Stack Overflow。您发布的设置中有什么不起作用?会发生什么?你期望发生什么?它工作正常,但我想使用nginx和gunicorn。哦,我明白了。我看了这个例子,只设置了一个站点,但是当我转到我的url时,我得到了ngnix默认值,当我转到我的ip时,我看到了我的站点Dominice你能写下答案吗?这样我就可以接受它了,因为我遵循了链接,它工作得很好,尽管我不得不读更多的文档