我想承载一个网站,由django应用程序和tilestache服务的地图瓷砖组成。我可以让他们运行,并通过使用Nginx conf为两个gunicorn应用程序(django和tilestache)
gunicorn_django -b 0.0.0.0:8000
为Django应用程序,或
gunicorn "TileStache:WSGITileServer('tilestache.cfg')"
为tilestache分别提供内容服务。我已经尝试守护django应用程序,并在不同的端口上使用tilestache进程同时运行它们(8080
),但tilestache不起作用。我认为问题在于我的nginx的conf:
server {
listen 80;
server_name localhost;
access_log /opt/django/logs/nginx/vc_access.log;
error_log /opt/django/logs/nginx/vc_error.log;
# no security problem here, since/is alway passed to upstream
root /opt/django/;
# serve directly - analogous for static/staticfiles
location /media/ {
# if asset versioning is used
if ($query_string) {
expires max;
}
}
location /static/ {
# if asset versioning is used
if ($query_string) {
expires max;
}
}
location/{
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 10;
proxy_read_timeout 10;
proxy_pass http://localhost:8000/;
}
# what to serve if upstream is not available or crashes
error_page 500 502 503 504 /media/50x.html;
}
我可以只添加其他server
块在conf为proxy_pass http://localhost:8080/
?此外,我对这个堆栈非常陌生(我非常依赖Adrián Deccico的教程here来让django部分启动并运行),所以任何“哇,这是一个明显的错误”或建议将不胜感激。
您将如何区分这两个应用 - 他们使用不同的领域 - 像www.mydjangoapp.com和www.mytilestache.com?或者他们共享相同的域名,但使用不同的/路径/? – Tisho 2012-07-17 07:46:19
@Tisho相同的域名,不同的路径。我已经看到了很多地图示例,它们将tile服务器放在子域上,并且可以开放。 – Chris 2012-07-17 07:48:44