2013-08-02 64 views
1

你好全部是新來的Django和所有的好東西生病想知道如何建立這樣的nginx的和gunicorn的Django項目感謝nginx的和gunicorn的Django項目

虛擬主機1

<VirtualHost *:80> 
ServerName project1.com 
ServerAlias www.project1.com 
ServerAdmin [email protected] 

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> 

虛擬主機2

<VirtualHost *:80> 
ServerName project2.com 
ServerAlias www.project2.com 
ServerAdmin [email protected] 

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> 
+0

嗨威廉 - 歡迎來到堆棧溢出。什麼不適用於您發佈的設置?怎麼了?你期望會發生什麼? –

+0

其工作正常,但我想用nginx和gunicorn。 –

+1

哦 - 我明白了。閱讀http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/,看看你如何繼續。 –

回答