Articles of 坞

Docker安装nginx

我新与docker,并希望在我的容器内安装nginxredirect在外部IP 我的目标是向docker中的http://localhost:3010/api/v1/service发送请求,并将其redirect到我的http://192.168.99.1:3010/api/v1/service 或者,也许我完全错了我的想法? 我试图做到RUN yum install nginx但我有 dockerfile

在Nginxconfiguration文件中访问容器名称

在Docker中,我使用docker network create usta_network了一个新的networkingdocker network create usta_network命令,并在docker-compose.yml文件的服务声明中引用此networking。 没关系,我现在可以用容器的名字来ping服务,但是我怎么能在Nginx的上游声明中引用一个容器的名字呢? 在集装箱之间进行访问是最好还是最好的做法? docker.compose for nginx version: '2' services: nginx-main: image: nginx:latest ports: – "80:80" volumes: – ./nginx.conf:/etc/nginx/nginx.conf:ro – /var/log/nginx:/var/log/nginx container_name: nginx_main networks: default: external: name: usta_network ./nginx.conf 用户nginx; http { server { listen 80; index index.php index.html index.htm; server_name example.org www.example.org; location / { proxy_set_header Host $host; proxy_set_header […]

你可以使用nginx反向代理泊坞窗容器而不暴露任何端口?

我想知道是否有可能与Docker组合使用nginx作为api网关/反向代理/ ssl终止点而不暴露容器后面的任何端口。 也就是说,我只想使用由docker撰写的内联网,当容器被链接到通过nginx进行通信时。 理想情况下,唯一可公开访问的端口将是nginx上的端口443(ssl)。 这是可行的吗? 或者我必须公开我的容器上的端口?

docker工人组成:重build一个链接的容器打破了nginx的上游

我正在使用Docker docker-compose和“Docker for Mac”,我有两个容器:一个NGINX,一个容器在端口3000上提供节点应用程序。 docker-compose.yml看起来像这样: version: "2" services: nginx: build: ./nginx ports: – "80:80" links: – api api: build: ./api volumes: – "./api:/opt/app" 在NGINX的configuration中我说: upstream api { server api:3000; } server { # …. location ~ ^/api/?(.*) { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_pass http://api; proxy_redirect off; } } 现在,当我改变节点代码中的东西,并重build容器 $ […]

Docker + nginx + PHP – nginx是不是指向根目录?

我按照这个指南在Docker上运行PHP,但是nginx并没有指向我在site.conf中设置的根目录。 泊坞窗,compose.yml: nginx: image: nginx:latest ports: – 8080:80 volumes: – ./code:/code – ./site.conf:/etc/nginx/conf.d/site.conf links: – php php: image: php:7-fpm volumes: – ./code:/code site.conf: server { index index.php index.html; server_name localhost; error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; root /code; location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass php:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param […]

在一台主机上运行两个docker组合应用程序的最好方法是在nginx后面运行?

我有两个docker-compose应用程序: a.com b.com 我想在同一台主机上运行它们,并放置一个nginx容器代理,将传入的请求路由到每个docker-compose应用程序中的正确服务。 我想我需要一个单独的nginx容器,从两个docker-compose应用程序分开运行。 我之前使用过nginx-proxy ,但是我的路由已经变得更加复杂了,所以我现在想运行我自己的nginx实例。 我无法弄清楚如何连接两个应用程序和nginx容器,使这一切都以一种理智的方式工作。 当我docker run nginx容器时,我得到: host not found in upstream "MY_CONTAINER_HOST_NAME" ,这表明我的应用程序主机名不是从nginx容器内parsing。 如果需要,我可以发布我的nginxconfiguration,但这实际上是一个dockernetworking/最佳实践问题。

泊坞窗 – 与鬼和一个nginx代理组成错误

所以,我开始使用docker-compose 现在,我遇到了nginx代理请求的问题。 所以我有一个使用鬼影的容器,并在2368年曝光: ghostblog: container_name: ghostblog image: ghost restart: always ports: – 2368:2368 env_file: – ./config.env volumes: – "./petemsGhost/content/themes:/usr/src/ghost/content/themes" – "./petemsGhost/content/apps:/usr/src/ghost/content/apps" – "./petemsGhost/content/images:/usr/src/ghost/content/images" – "./petemsGhost/content/data:/usr/src/ghost/content/data" – "./petemsGhost/config:/var/lib/ghost" 我把它链接到一个nginx容器,它代理对容器的请求: ghost_nginx: restart: always build: ./ghostNginx/ ports: – 80:80 – 443:443 links: – 'ghostblog:ghostblog' 在这个版本里面,我复制了一堆东西,按键,configuration等等: Dockerfile FROM centos:centos6 # Delete defaults RUN yum install epel-release -y RUN yum […]

Docker – 安装php-memcached extenstion不工作?

我一直试图安装memcached在我的php-5.6容器,但是我无法得到它的工作,因为我没有看到在phpinfo()memcached扩展和加上由于某种原因,它的compcomping它不能findmemcache.so代码。 有我的docker文件为PHP构build FROM php:5.6-fpm RUN apt-get update && apt-get install -y \ libfreetype6-dev \ libjpeg62-turbo-dev \ libmcrypt-dev \ libpng12-dev \ && docker-php-ext-install -j$(nproc) iconv mcrypt \ && docker-php-ext-configure gd –with-freetype-dir=/usr/include/ –with-jpeg-dir=/usr/include/ \ && docker-php-ext-install -j$(nproc) gd RUN docker-php-ext-install mysqli mbstring pdo_mysql # Download and Installing php libraries RUN apt-get install -y memcached RUN apt-get -y […]

Docker – 在Docker容器外部用PHP创build目录

这是我的第一个问题,所以希望我不会违反任何规则:) 我试图运行一个脚本,在/ var / www /中创build一个子目录。 我有一个脚本,应该创build一个自动转换为LEMP vHost的目录 – 它检查包含htdocs的子文件夹/ var / www目录,然后自动生成一个虚拟主机。 LEMP(nginx,PHP 5.6,MySQL)堆栈运行在Ubuntu 16.04 Server上的Docker容器中。 问题是,我无法find一个方法来获得适当的权限configuration这个任务。 我的代码如下所示: <?php if(mkdir("/var/www/".$_POST['name']."/htdocs", 0644, true)) { echo('vHost created'); } else { echo('ERROR!'); } ?> 我目前对/ var / www目录的权限是777(我知道这不是很安全的做法,但是我绝望了)。 我正在尝试各种权限和所有权 – 容器的内部和外部,但每次我调用一个PHP文件,它会返回以下错误。 Warning: mkdir(): Permission denied in /var/www/default/htdocs/createVhosts.php on line 42 任何想法或build议,我应该尝试?

如何设置nginx作为Ruby应用程序的反向代理(所有在Docker中运行)

我正在尝试使用nginx和Ruby应用程序来设置一个简单的反向代理,但是我也想在Docker容器中设置它。 我已经到了可以从Docker中运行Ruby应用程序的地步,并且可以从主机(使用Boot2Docker的Mac OS X)访问正在运行的服务。 但是我现在坚持尝试实现nginx的一部分,因为我以前没有使用它,似乎大多数关于该主题的文章/教程/例子使用Rails(而不是一个简单的Sinatra / Rack应用程序),也利用sockets – 我根本不需要知道。 我也在使用Docker Compose。 完整的目录结构如下所示: ├── docker-compose.yml ├── front-end │ ├── Dockerfile │ ├── Gemfile │ ├── app.rb │ ├── config.ru ├── proxy │ ├── Dockerfile │ ├── nginx.conf │ └── public │ ├── 500.html │ ├── index.html 要查看这些文件的内容,请参阅以下要点: https://gist.github.com/Integralist/5cfd5c884b0f2c0c5d11 但是当我运行docker-compose up -d ,出现以下错误: Creating clientcertauth_frontend_1… Pulling image […]