我在Nginx反向代理后面部署一个简单的Flask应用程序时遇到了问题。这个应用程序就是在https://docs.docker.com/compose/gettingstarted找到的/
我正试图让应用程序显示在subdomain.example.com/flask
,但以当前的配置,它不工作。我错过了什么?
现在我的docker-compose.yml
看起来像这样:
version: '3' services: nginx: container_name: nginx build: context: ./nginx volumes: - ./config/:/etc/nginx/ - ./ssl-cert/:/etc/ssl/private/ depends_on: - web ports: - 80:80 web: build: context: ./composetest expose: - 5000 redis: image: "redis:alpine"
这是我的Nginx的default.conf
:
server { listen 80; server_name subdomain.example.com; location /flask{ proxy_pass http://web:5000; } }
当我执行docker-compose up --build
时,我没有从Nginx容器或其他容器中得到任何错误(显然忽略了与production-ready相关的错误)。
下面是我运行上述命令时看到的内容:
redis_1 | 1:C 16 May 2021 14:08:42.327 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo redis_1 | 1:C 16 May 2021 14:08:42.335 # Redis version=6.2.3, bits=64, commit=00000000, modified=0, pid=1, just started redis_1 | 1:C 16 May 2021 14:08:42.335 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf redis_1 | 1:M 16 May 2021 14:08:42.336 * monotonic clock: POSIX clock_gettime redis_1 | 1:M 16 May 2021 14:08:42.337 * Running mode=standalone, port=6379. redis_1 | 1:M 16 May 2021 14:08:42.337 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. redis_1 | 1:M 16 May 2021 14:08:42.337 # Server initialized redis_1 | 1:M 16 May 2021 14:08:42.337 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. redis_1 | 1:M 16 May 2021 14:08:42.338 * Ready to accept connections web_1 | * Serving Flask app 'app.py' (lazy loading) web_1 | * Environment: production web_1 | WARNING: This is a development server. Do not use it in a production deployment. web_1 | Use a production WSGI server instead. web_1 | * Debug mode: off web_1 | * Running on all addresses. web_1 | WARNING: This is a development server. Do not use it in a production deployment. web_1 | * Running on http://192.168.112.4:5000/ (Press CTRL+C to quit)
原文链接:https://www.5axxw.com/questions/content/ztb364
© 版权声明
声明📢本站内容均来自互联网,归原创作者所有,如有侵权必删除。
本站文章皆由CC-4.0协议发布,如无来源则为原创,转载请注明出处。
THE END