Tag: nginx

使用moodle 3.3.2通过自定义的docker映像与fpm:无尽的303redirect循环

我正在尝试为这个项目创build一个基于alpine-fpm的包但是我无法使用基于alpine_mysql的图像通过一个nginx运行,无论我尝试了多less努力。 我得到的问题是,mooodle安装做一个redirect循环,因此浏览器不提供moodle。 nginxconfiguration是在这个文件中,而我也试过这个选项没有成功(还没有提交更改): events { worker_connections 768; } http { include /etc/nginx/mime.types; default_type application/octet-stream; charset utf-8; gzip on; gzip_disable "msie6"; client_max_body_size 10000M; server { listen 80 default_server; server_name _; root /var/www/html; index index.php; location / { try_files $uri $uri/ =404; } location ~ \.php$ { fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; fastcgi_param QUERY_STRING $query_string; fastcgi_param […]

dockerd错误上传失败:\“var / log / alternatives.log \”的文件完整性校验和失败

我们有我们自己的dockerregistry来存储我们的图像。 在这个registry中,我们可以推送图像没有问题,除了一个项目使用nginx。 这是我们在推送图像时遇到的错误,构build过程很好: Upload failed, retrying: file integrity checksum failed for \"var/log/alternatives.log\" 我们甚至在构build和推送图像时都尝试删除Docker文件中的文件。 有人知道这里发生了什么,以及如何解决这个问题? 有什么办法可以避免这种完整性校验和validation可能吗? 甚至更好,有没有人知道如何不对日志文件执行完整性校验和validation? 谢谢! 在这里你可以find在debugging模式下运行的docker守护进程的完整输出: dockerd[37603]: level=debug msg="Calling GET /_ping" dockerd[37603]: level=debug msg="Calling POST /v1.29/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=docker-registry.cobrowser.io%2Fnginx-edge%3Adevelop_8d07da6&target=&ulimits=null" dockerd[37603]: level=debug msg="[BUILDER] Use cached version: [/bin/sh -c apt-get clean all && apt-get update && apt-get upgrade -y –no-install-recommends && apt-get install -y –no-install-recommends dnsutils]" dockerd[37603]: level=debug […]

带有NGINX负载均衡器的Tomcat群集

我试图用NGINX作为负载均衡器创build一个5个Tomcat映像集群。 我将Tomcat留在默认端口8080上。我只能在bash中运行NGINX,否则会立即closures。 我得到的一个错误是“[emerg] 20#20:在/etc/nginx/nginx.conf中找不到上游主机”tcat-srv1:8080“:13” 我之前通过从app_servers取走端口8080解决了这部分问题; 在configuration文件中。 我现在再次得到同样的错误。 对于docker工人来说,我很新,我只是想找一些帮助让这个群集运行起来。 也许你们可以在我的configuration文件中看到我不知所云的东西。 编辑:我现在得到这个错误: [emerg] 67#67:bind()到0.0.0.0:8080失败(98:地址已经在使用)nginx:[emerg] bind()到0.0.0.0:8080失败(98:地址已经在使用) 任何帮助表示赞赏! 附上了我的nginxconfiguration的屏幕截图。 这是我的命令: NGINX负载平衡器 docker run -d -it -v /home/mpickel/nginx.conf:/etc/nginx/nginx.conf -p MyIPAddress:8080:8080 –net tcatnw –hostname nginx1 –name nginx1 nginx bash Tomcat服务器1-5 dockernetworking创buildtcatnw docker run -d -it –name tcat-srv1 –hostname tcat-srv1 –rm –net tcatnw tomcat docker run -d -it –name tcat-srv2 –hostname tcat-srv2 […]

letsencrypt webroot为位于docker的nginx提供了404

我有一个简单的docker容器运行在以下方式: docker service create –name nginx_proxy \ –mount type=bind,source=/opt/nginx/conf.d,target=/etc/nginx/conf.d \ –mount type=bind,source=/opt/nginx/webroot,target=/var/webroot \ –constraint 'node.role==manager' \ –publish 80:80 –publish 443:443 \ –network nginx-net \ nginx 创build的服务运行没有问题。 我添加了代理传递给同一networking中另一个服务的示例configuration(example.com.conf): server { listen 80; server_name example.com www.example.com; location /.well-known/acme-challenge { alias /var/webroot; } location / { proxy_pass http://example_site:8080; } } 当我去(www。)example.com时,我可以看到我的网站。 由于我将host:/ opt / nginx / webroot装载到容器:/ var […]

Nginx代理导致错误:getaddrinfo EAI_AGAIN

在尝试为我的项目设置Docker容器时遇到了一个错误,我不明白。 我的设置涉及多个运行在不同容器中的Node.js应用程序,以及一个nginx代理服务器来处理所有传入应用程序的stream量。 我的nginx代理如下所示: server { listen 80; server_name "~^(?<service>\w{1,}+)\-?\w*\.something\.com$"; location / { resolver 127.0.0.11; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_request_headers on; proxy_pass http://$service:8081; } } 这使用RegEx从URL中获取服务器名称,并将stream量代理到端口8081上正确的服务器,该服务器似乎正常工作。 应用程序正在成功路由。 当我的Node.js应用程序尝试向REST API发出外部http请求并引发以下错误时,会发生此问题 { Error: getaddrinfo EAI_AGAIN dev.something.com:443 at Object.exports._errnoException (util.js:1020:11) at errnoException (dns.js:33:15) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26) code: 'EAI_AGAIN', errno: 'EAI_AGAIN', syscall: 'getaddrinfo', […]

如何使用NGINX将所有请求redirect到子path?

应用程序,问题和目标的概述。 该应用程序由微服务networking组成,包装在单独的Docker容器中。 这些容器是Django,Postgres,Nodejs(+ Socket.io)和Nginx + Angular2(静态文件)。 Nginx目前具有特定的文件path,并将所有其他请求路由到Angular2应用程序,然后它有自己的路由器。 目前,应用程序可以直接从根目录提供,但必须移到子目录中。 该地址随后将包含该目录的新path。 所以它部署到… http://host ,但不与http://host/path ,因为在微服务中的所有请求都得到路由NGINX逆向代理。 我怎样才能使用NGINX重写/redirect追加/path的URL,以便它可以从子目录服务,但NGINX仍然知道这些位置仍然存在于根级别? 我的301尝试 location = / { root /www/ng; try_files $uri $uri/ /index.html; return 301 http://$host/pot; } 在这里,我做了301redirect捕获所有位置。 它适用于这个捕获所有,但是当将301添加到静态位置时,redirect不起作用。 301是最好的解决scheme吗? 我将如何redirect静态位置? 原始的NGINX conf文件 server { listen 80; client_max_body_size 10M; root /www/data; location /static { alias /var/www/static; } location /media { alias /var/www/media; } […]

nginx不会自动获取群集中的dns更改

我通过docker swarm中的缺省nginxconfiguration(根据lets-nginx项目)中的let-nginx运行nginx: 服务: ssl: image: smashwilson/lets-nginx networks: – backend environment: – EMAIL=sas@finestructure.co – DOMAIN=api.finestructure.co – UPSTREAM=api:5000 ports: – "80:80" – "443:443" volumes: – letsencrypt:/etc/letsencrypt – dhparam_cache:/cache api: image: registry.gitlab.com/project_name/image_name:0.1 networks: – backend environment: – APP_SETTINGS=/api.cfg configs: – source: api_config target: /api.cfg command: – run – -w – tornado – -p – "5000" api是一个在群集覆盖networkingbackend上运行5000端口的应用程序。 当服务最初启动时,一切正常。 然而,每当我更新api使api容器在三个节点群中的节点之间移动时, […]

端口不会在swarm master中使用“docker stack deploy”发布

有两个节点(一个主站和一个从站)。 在swarm master中执行docker stack deploy -c compose.yml nginx ,我可以看到这个nginx实例正在slave( docker ps )中运行。 当我在master和slave上执行curl -XGET localhost:9999时,我在swarm master中得到超时 ,但是在swarm slave上得到了结果(index.html)。 为什么是这样? compose.yml version: '3' services: nginx: image: 10.31.207.156:5000/nginx ports: – 9999:80 dockerfile FROM registry.docker-cn.com/library/nginx COPY . /usr/share/nginx/html 的index.html <!DOCTYPE html> <html> <head> </head> <body> <div>Hello World</div> </body> </html> 顺便说一句,我在CentOS 7.3上运行docker

MySQL的Docker代理:来自主机的“丢失连接”消息

我想要的是 有https://github.com/jwilder/nginx-proxy包。 这对于“HTTP”非常有用,但我也想用它来TCP。 (MySQL的) 这里是我的变化: https : //github.com/fchris82/nginx-proxy/commit/33d80ea4d4be5d511e4dab0413d516770aa15262 正如你所看到的,我已经添加了stream {}块到nginx.conf和/etc/nginx/stream.conf.d目录。 这里是stream块的生成的default.conf : access_log off; error_log /var/log/nginx/debug.log debug; resolver 127.0.0.11; # whoami.loc upstream whoami.loc { ## Can be connect with "nginxproxy_default" network # nginxproxy_mysql_1 server 192.168.32.2:3306; } server { listen whoami.loc:81; proxy_pass whoami.loc; } 我做了什么,你怎么能重现错误 # Set host > sudo echo "127.0.0.1 whoami.loc" >> /etc/hosts # […]

Nginx反向代理到Docker中的.Net Core API

我无法尝试在Docker中使用以下内容 我想要的是,当用户请求http://localhost/api然后NGINX反向代理到我的.Net核心API运行在另一个容器。 容器主机:Windows 容器1:NGINX dockerfile FROM nginx COPY ./nginx.conf /etc/nginx/nginx.conf nginx.conf user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { server { location /api1 { proxy_pass http://api; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } } include /etc/nginx/mime.types; default_type application/octet-stream; log_format main […]