首页 \ 问答 \ 我正在尝试将nginx配置为代理服务器,但在编写docker文件时出现错误(I am trying to configure nginx as proxy server but getting an error while composing docker file)

我正在尝试将nginx配置为代理服务器,但在编写docker文件时出现错误(I am trying to configure nginx as proxy server but getting an error while composing docker file)

我正在尝试将nginx配置为代理服务器,但出现错误。 作为我工作的一部分,我创建了以下文件。

DockerFile

 FROM nginx:1.10.1-alpine
 RUN rm /etc/nginx/conf.d/*
 COPY proxy.conf /etc/nginx/conf.d/

Proxy.config

server {

listen 80;

location / {
    proxy_pass http://app;

}
}

泊坞窗,compose.yml


version: '2'

services:
app:
    build: app

proxy:
    build: proxy
    ports:
      - "80:80"

当我构建docker-compose文件时,出现以下错误:

Puja:Docker pujadudhat$ docker-compose build
Building app
Step 1/2 : FROM nginx:1.10.1-alpine
---> 2cd900f340dd

Step 2/2 : COPY index.html /usr/share/nginx/html
---> Using cache
---> 9d105a18fb9d
Successfully built 9d105a18fb9d
Building proxy

Step 1/3 : FROM nginx:1.10.1-alpine
---> 2cd900f340dd  
Step 2/3 : RUN rm /etc/nginx/conf.d/*
---> Using cache
---> a4e1efc3f050
Step 3/3 : COPY proxy.conf /etc/nginx/conf.d/
ERROR: Service 'proxy' failed to build: lstat proxy.conf: no such file or directory

我得到这个错误“Service'proxy'failed to build:lstat proxy.conf:no such file or directory。谁能帮我解决吗?


I am trying to configure nginx as proxy server but getting an error. I have created below file as part of my work.

DockerFile

 FROM nginx:1.10.1-alpine
 RUN rm /etc/nginx/conf.d/*
 COPY proxy.conf /etc/nginx/conf.d/

Proxy.config

server {

listen 80;

location / {
    proxy_pass http://app;

}
}

docker-compose.yml


version: '2'

services:
app:
    build: app

proxy:
    build: proxy
    ports:
      - "80:80"

When I build docker-compose file I am getting following error:

Puja:Docker pujadudhat$ docker-compose build
Building app
Step 1/2 : FROM nginx:1.10.1-alpine
---> 2cd900f340dd

Step 2/2 : COPY index.html /usr/share/nginx/html
---> Using cache
---> 9d105a18fb9d
Successfully built 9d105a18fb9d
Building proxy

Step 1/3 : FROM nginx:1.10.1-alpine
---> 2cd900f340dd  
Step 2/3 : RUN rm /etc/nginx/conf.d/*
---> Using cache
---> a4e1efc3f050
Step 3/3 : COPY proxy.conf /etc/nginx/conf.d/
ERROR: Service 'proxy' failed to build: lstat proxy.conf: no such file or directory

I am getting this error "Service 'proxy' failed to build: lstat proxy.conf: no such file or directory. Can anyone help me to solve? Thank you.n


原文:https://stackoverflow.com/questions/42909807
更新时间:2023-12-30 18:12

最满意答案

这是由自动完成小部件中的“不幸”选择引起的 - 它不知道您选择的是哪个项目,除非您之前已“悬停”它以使其成为活动菜单选项。

$('<button></button>')
  .click(function() {
    $("#open").click();
    $("a:contains('item2')").trigger('mouseover').trigger('click');
  })
  .appendTo('body');

This is caused by an "unfortunate" choice in the autocomplete widget -- it doesn't know what item you're selecting unless you've previously "hovered" it to make it the active menu choice.

$('<button></button>')
  .click(function() {
    $("#open").click();
    $("a:contains('item2')").trigger('mouseover').trigger('click');
  })
  .appendTo('body');

相关问答

更多
  • 好吧,首先,有一个问题,因为你在定义之前调用触发change()处理程序。 你想达到什么目的? 调用.change()和.change()可以运行这些事件的函数。 编辑: 根据您最近对问题的更新:是的,这将按预期工作。 加载时将调用.click和.change。 Well, first of all, there's an issue because you are calling triggering change() handler before it is defined. What are you ...
  • 事件回调仅触发一次,但并不意味着事件不会冒泡。 仅当元素侦听事件时才执行回调。 如果您真的希望将警报一直触发回祖先,请在回调中逐个添加祖先的警报。 您不必向所有祖先添加侦听器,这会导致消耗更多内存。 Event callback is only triggered once, but it does not mean the event does not bubble. The callback is only executed when the very element listens to the ev ...
  • 这个解决方案适用于我(我只支持最近的浏览器,所以我试图修改代码更复古): HTML:
  • {{item.title}}

  • 脚本: function remove(item, $event) { // do some code here ...
  • 我认为你需要做的是防止事件冒泡DOM树并防止任何父处理程序被通知事件是使用stopPropagation()方法。 $('.item-button').click(function(event) { event.stopPropagation(); // your code... 有关更多信息: 1。jquery 2. javascript I think what you need to do to prevent the event from bubbling up the DOM ...
    • 元素包含
    • 元素,这就是当您单击任一项时警报触发的原因。 对于将click事件附加到的每个DOM元素都会发生相同的情况 - 所有子元素在单击时都会触发事件(除非您通过调用event.stopPropagation()停止传播)。 目前,它与事件冒泡无关。 当注释正确表示时,冒泡是在事件触发元素时,然后按顺序触发父元素。 你的评论也是正确的。 如果您为li附加了一个事件,您将看到两个警报,您可以在我制作的这个小提琴中看到。 The
        element is wrapping the
      • ...
  • 这是由自动完成小部件中的“不幸”选择引起的 - 它不知道您选择的是哪个项目,除非您之前已“悬停”它以使其成为活动菜单选项。 $('') .click(function() { $("#open").click(); $("a:contains('item2')").trigger('mouseover').trigger('click'); }) .appendTo('body'); This is caused by an "unfortun ...
  • 将您的JS更改为以下内容: $(".dropdown-item").on("click", function(e) { e.preventDefault(); $(this).find(".sub-dropdown").toggle(); }); $(".sub-dropdown").on("click", function(e) { e.stopPropagation(); $(this).find(".sub-dropdown-child").slideToggle(); ...
  • 为此,您必须使用Angular和jQuery事件处理。 请参阅下面的代码段。 和工作https://plnkr.co/edit/seF391qx3OcUubT8MeO7?p=preview var app = angular.module('myApp', []); app.controller('demoController', function($scope, $anchorScroll) { $scope.list = {}; $scope.list.subItems = ['i ...
  • 我要求快速解决该问题:检索已存储的项目的值,但在表单中更容易和更干净。 我的修复是在我的Symfony表单中修改Transformer。 由于这不是PHP主题,我不会详细介绍。 总之:应该有一种更好的方法来实现这一点,而不是强制执行click()事件。 I asked for a quick fix of that problem: retrieve the value of the item that its already stored, but it's easier and cleaner doin ...
  • 防止冒泡和取消默认浏览器行为之间存在差异。 尝试添加 return false; 在你的处理程序函数的最后,像这样 $expandBooksbutton.on('click', function(event){ var height = $('#book-container').height(); if(height != 200){ $('#book-container').height(200); } else{ $('#book ...
  • 相关文章

    更多
  • configure原理
  • nginx下载与安装
  • Docker常用命令
  • Nginx配置文件详解
  • nginx开机启动
  • Keepalived+Nginx实现高可用和双主节点负载均衡
  • CentOS下用Tomcat+Zookeeper+Nginx+Solr完美搭建SolrCloud平台(四)
  • nginx开机自动启动设置
  • nginx基本运行命令
  • 最新问答

    更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)