Tag: nginx

docker nginx连接被拒绝,同时连接到上游

我使用shiny的服务器来build立一个端口3838的networking应用程序,当我在我的服务器使用nginx它运作良好。 但是当我在我的服务器上停止nginx并尝试使用docker nginx时,我发现该站点出现'502-Bad Gate Way'错误,nginx日志显示: 2016/04/28 18:51:15 [error] 8#8: *1 connect() failed (111: Connection refused) while connecting to upstream, … 我用这个命令安装docker-nginx: sudo docker pull nginx 我的docker命令行是类似的(清除我添加一些缩进): sudo docker run –name docker-nginx -p 80:80 -v ~/docker-nginx/default.conf:/etc/nginx/conf.d/default.conf -v /usr/share/nginx/html:/usr/share/nginx/html nginx 我在我的家目录中创build一个文件夹名称“docker-nginx”,将我的nginx conf文件移动到这个文件夹中,然后删除我的原始conf在etc / nginx目录中以防万一。 我的nginx conf文件看起来像这样: server { listen 80 default_server; # listen [::]:80 default_server ipv6only=on; root […]

重build后文件更改不会反映在Docker镜像中

我试图为我的PHP web应用程序(php-fcm)设置两个Docker镜像,由NGINX反向代理。 理想情况下,我希望将Web应用程序的所有文件复制到基于php-fcm的映像中,并将其作为卷展示。 这样,两个容器(网页和应用程序)都可以通过NGINX服务静态文件和php-fcm来解释php文件。 泊坞窗,compose.yml version: '2' services: web: image: nginx:latest depends_on: – app volumes: – ./site.conf:/etc/nginx/conf.d/default.conf volumes_from: – app links: – app app: build: . volumes: – /app Dockerfile: FROM php:fpm COPY . /app WORKDIR /app 上述设置按预期工作。 但是,当我对文件做任何改变,然后做 compose up –build 新的文件不会在结果图像中拾取。 尽pipe以下消息表明图像确实正在重build: Building app Step 1 : FROM php:fpm —> cb4faea80358 Step 2 […]

docker和春季启动:如何隐藏端口从url?

我尝试在DigitalOcean上部署我的Spring Boot。 我build立docker的形象,并在服务器上运行,一切都很好( docker run -p 8080:8080 hub_user/docker_image )。 我有我自己的域名和IP地址(访问我的应用程序的url是myapp.com:8080 )。 但是,我怎样才能隐藏端口号从URL访问我的应用程序? 如何在没有端口8080情况下使用我的域名?

NGINX基于环境variables的基本authentication

我正在设置一个安装了nginx-lua的docker镜像。 该场景是在分段上进行基本身份validation,但不是在生产中。 我的想法是有一个ENVvariables与阶段的名称,并检查nginx.conf文件中的值。 docker-compose.yml文件的内容(当然,对于STAGE env来说,生产环境也是一样): docs-router: build: ./nginx environment: – API_BASE_URI=staging.example.com – DOCS_STATIC_URI=docs-staging.example.com – STAGE=staging ports: – "8089:8089" – "8090:8090" nginx.conf文件的内容: … env API_BASE_URI; env DOCS_STATIC_URI; env STAGE; … http { server { listen 8089 default_server; charset utf-8; resolver 8.8.8.8; access_log off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location ~ ^(/.*\.(?:apib|svg))?$ { […]

用于NGINX Web服务器的Dockerfile

我一直在试图build立一个托pipeNGINX服务器的本地Docker容器。 首先,这里是我的Dockerfile: # Set nginx base image FROM nginx # File Author / Maintainer MAINTAINER myuser "myemail@mydomain.com" # Copy custom configuration file from the current directory COPY nginx.conf /etc/nginx/nginx.conf 我使用docker build命令构build了这个文件,当我列出这些图像时,我可以在列表中看到这个图像。 现在,我试图运行这个新创build的图像,导致一个错误: my-MacBook-Pro:nginx-docker me$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE myrepo nginx-latest 0d73419e8da9 12 minutes ago 182.8 MB hello-world latest c54a2cc56cbb 13 days […]

使用NginX在服务器上部署Angular2应用程序时,不会加载子组件

我在服务器上将我的Angular2应用程序部署为一个Docker镜像,它由NginX提供。 但有些奇怪的事情发生。 当我在本地运行我的webpack-dev-server时,检查它是否可以正常工作,我得到预期的视图 其中根组件包含描述和链接,第二个包含“顶级post”等内容。 然后,我用NginX将它打包到Docker镜像中,并在服务器上提供。 但不是上面的观点,我得到了这个 控制台什么也没有 加载子组件的问题可能是什么原因? 下面的configuration。 的index.html <html> <head> <base href="/"> <title>Zielony</title> <meta charset="utf-8"> <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.en"></script> <script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit"></script> </head> <body> <my-app>Loading…</my-app> </body> <script src="/app.js"></script> </html> boot.ts export const routes: RouterConfig = [ { path: '', redirectTo: 'dashboard', pathMatch: 'full' }, { path: 'posts', component: PostsComponent, canActivate: [LoggedInGuard] }, { path: 'dashboard', component: […]

如何正确设置数据卷容器?

我想设置一个数据卷容器与另一个LAMP容器一起工作,但我开始与Docker一起工作,所以我有一些疑虑。 所以我将运行两个容器,我们将其命名为(仅作为示例): 灯容器 数据容器 我知道一次运行多个容器的唯一方法是使用Docker Compose,但我不知道如何设置compose.yml文件。 让我们说lamp-container有它存储数据的以下目录: /data/www # meant to contain web content /data/www/default # root directory for the default vhost /data/logs/ # Nginx, PHP logs /data/tmp/php/ # PHP temp directories 我想将它们分别映射到/home/<username>/container_files (这是运行docker的主机上的本地目录)下的主机上的本地目录。 例如: /data/www => /home/<username>/container_files/data/www /data/www/default => /home/<username>/container_files/data/www/default /data/logs/ => /home/<username>/container_files/data/logs /data/tmp/php/ => /home/<username>/container_files/data/php 任何一点都可以用compose.yml示例文件指向正确的方向? 我已经阅读文档,但对我来说很困惑,因为我通常使用虚拟机,并在许多方面与容器不同。 注意:我应该补充说,这是一个主机中的一个用户而不是一个主机中的多个用户。 所以每个想要使用这个设置的人都应该有自己的主机下的设置。

如何在不同的Docker容器中运行uWSGI和NGINX

我已经在本地设置了uWSGI和NGINX,并且我的configuration在提供Web请求时没有问题。 但是,当我装载uWSGI和NGINX(在单独的Docker容器中)时,我似乎无法build立连接。 我的NGINX服务器configuration如下所示: server { listen 80; server_name localhost; location / { include uwsgi_params; uwsgi_pass uwsgi.app:9090; } } 我的uWSGI ini文件如下所示: [uwsgi] socket = localhost:9090 module = uwsgi:app processes = 4 threads = 2 master = true buffer-size = 32768 stats = localhost:9191 die-on-term = true vaccuum = true 我运行在同一个用户生成的网桥使用以下uWSGI docker run -p 9090:9090 –network main […]

使用Nginx作为微服务API网关

我们正在将我们的巨无霸API分成微服务。 我们不需要速度限制,authentication,caching或任何其他网关,如能力。 使用非常简单的无状态Nginx容器路由到底层服务是否是一种有效的方法?

将Docker容器部署到AWS时,是否还需要部署自己的反向代理?

我有一个Rails API来处理其他客户端应用程序的数据和服务器逻辑。 在dockerizing并将其部署到AWS弹性beanstalk(通用泊坞窗 – 单容器)时,它将失败。 我是否需要部署多个容器,以包含我自己的nginxconfiguration? 还是AWS有办法为我处理反向代理? 只是寻找一点指导。 如果我必须自己处理nginx,那么很好(而且任何指针都会很好),但是我实际上正在尝试将尽可能多的设置和configuration转移到AWS提供的服务上,并且更加关注我需要的代码编写API本身