简体   繁体   English

我正在尝试将Nginx配置为代理服务器,但在编写Docker文件时出现错误

[英]I am trying to configure nginx as proxy server but getting an error while composing docker file

I am trying to configure nginx as proxy server but getting an error. 我正在尝试将Nginx配置为代理服务器,但出现错误。 I have created below file as part of my work. 我在工作中创建了以下文件。

DockerFile DockerFile

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

Proxy.config Proxy.config

server {

listen 80;

location / {
    proxy_pass http://app;

}
}

docker-compose.yml 泊坞窗,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: 当我构建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

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 我收到此错误“服务'proxy'无法构建:lstat proxy.conf:没有这样的文件或目录。有人可以帮助我解决吗?谢谢。

Looks like you are missing the proxy.conf in your project where you build the docker container. 看起来您在构建Docker容器的项目中缺少proxy.conf。 It looks like you have it named Proxy.conf and it should be named proxy.conf . 看起来您将其命名为Proxy.conf ,并且应将其命名为proxy.conf

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何配置 Nginx 代理管理器来代理 OnlyOffice 文档服务器 Docker 容器? - How do I configure Nginx Proxy Manager to proxy an OnlyOffice Document Server Docker container? 为什么我收到 nginx web 服务器关闭或忙碌的错误? - why am I getting error for nginx web server down or busy? 我在与Nginx reverse_proxy达成我的Rest-API时得到404 - I am getting 404 while tying to reach my Rest-API with Nginx reverse_proxy 为什么我会收到有关“无此文件或目录”的Nginx错误? - Why am I getting this Nginx error about “No such file or directory”? 我可以使用 proxy_pass 配置 nginx 以使用代理服务器上的错误文档吗? - Can I configure nginx with proxy_pass to use an error document on the proxied server? 为什么我要为该Nginx反向代理获取404? - Why I am getting 404 for this nginx reverse proxy? 尝试将Nginx设置为Facebook的反向代理,但出现Facebook错误 - Trying to setup nginx as a reverse proxy for facebook, but getting facebook error 为什么我收到 nginx 的不允许错误? - why am I Getting a not allowed error with nginx? 我正在尝试从 nginx 代理安全 http 到 kong 但我收到有关 http 请求的错误发送到 Z299DC869EA246FF788A? - I am trying to proxy secure http to kong from nginx but I get an error about http request sent to an HTTP port? 错误:未指定输入文件。 Laravel 与 docker nginx-proxy - Error: no input file specified. Laravel with docker nginx-proxy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM