我正在尝试将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
最满意答案
这是由自动完成小部件中的“不幸”选择引起的 - 它不知道您选择的是哪个项目,除非您之前已“悬停”它以使其成为活动菜单选项。
$('<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');
相关问答
更多-
jquery事件冒泡(jquery event bubbling)[2023-04-10]
好吧,首先,有一个问题,因为你在定义之前调用触发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 bubbling for event delegation)[2023-07-20]
事件回调仅触发一次,但并不意味着事件不会冒泡。 仅当元素侦听事件时才执行回调。 如果您真的希望将警报一直触发回祖先,请在回调中逐个添加祖先的警报。 您不必向所有祖先添加侦听器,这会导致消耗更多内存。 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}}
-
我认为你需要做的是防止事件冒泡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事件附加到的每个DOM元素都会发生相同的情况 - 所有子元素在单击时都会触发事件(除非您通过调用event.stopPropagation()停止传播)。 目前,它与事件冒泡无关。 当注释正确表示时,冒泡是在事件触发元素时,然后按顺序触发父元素。 你的评论也是正确的。 如果您为li附加了一个事件,您将看到两个警报,您可以在我制作的这个小提琴中看到。 The
-
这是由自动完成小部件中的“不幸”选择引起的 - 它不知道您选择的是哪个项目,除非您之前已“悬停”它以使其成为活动菜单选项。 $('') .click(function() { $("#open").click(); $("a:contains('item2')").trigger('mouseover').trigger('click'); }) .appendTo('body'); This is caused by an "unfortun ...
-
JQuery事件冒泡问题(JQuery Event Bubbling Issue)[2023-01-23]
将您的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 ...
-
事件冒泡在jQuery中 - event.stopPropogation无法正常工作(Event bubbling in jQuery - event.stopPropogation not working)[2022-01-25]
防止冒泡和取消默认浏览器行为之间存在差异。 尝试添加 return false; 在你的处理程序函数的最后,像这样 $expandBooksbutton.on('click', function(event){ var height = $('#book-container').height(); if(height != 200){ $('#book-container').height(200); } else{ $('#book ...