http://stackoverflow.com/q/25909985/707580
两边都问问,看看哪边用docker的人多
我有一个简单的 python/flask app,部署在container上时是这样的:
/var/www/app/
appl/
static/
...
app.py
wsgi.py
在使用 docker 之前,我都是用 nginx 直接指向静态文件:
location /static {
alias /var/www/www.domain.com/appl/static;
}
location / {
uwsgi_pass unix:///tmp/uwsgi/www.domain.com.sock;
include uwsgi_params;
}
但是现在静态文件在 container 内部,nginx 看不到。
我能想到 2 种解决方案:
按和以前一模一样的配置在 docker 里面卡一个 nginx,然后让 host nginx 和 container nginx 通过 8000 端口直连,host nginx 是个纯 proxy
把 (host)/var/www/www.domain.com/static
挂到 (container)/var/www/static
,然后在启动脚本里把静态内容复制过去
更 docker 的方法是什么?
大家讲道理2017-04-21 11:17:36
The way to update docker is to plant nginx in it.
Docker’s goal is that the programs written now can still run in 10 years. In other words, it is a complete environment package.