[英]docker compose nginx proxy not redirecting
I have an Ubuntu server and have built an nginx proxy in one docker container and an nginx webserver in an other container and they are both in the same network and can see each other, but the proxy doesn't redirect to the webserver and I always get this error when accessing my website:我有一个 Ubuntu 服务器,并在一个 docker 容器中构建了一个 nginx 代理,在另一个容器中构建了一个 nginx 网络服务器,它们都在同一个网络中并且可以互相看到,但是代理不会重定向到网络服务器,我总是访问我的网站时出现此错误:
proxy | 2018/09/05 15:30:27 [alert] 8#8: 1024 worker_connections are not enough
proxy | 2018/09/05 15:30:27 [error] 8#8: *4086 upstream prematurely closed connection while reading response header from upstream, client: 172.18.0.1, server: , request: "GET / HTTP/1.0", upstream: "http://XX.XX.XX.XX:80/", host: "test.com"
I just realised, I did redirect my proxy container to itself, fixed it now ^^ 我刚意识到,我确实将我的代理容器重定向到了它自己,现在修复了它^^
server {
listen 80;
server_name proxy;
location / {
proxy_pass http://website/
}
}
server {
server_name website;
root /usr/share/nginx/html;
index index.php;
}
Another way to do this is to use a pre-packaged NginX http to https<\/em> docker image eg https:\/\/hub.docker.com\/r\/foxylion\/nginx-https-redirect\/<\/a>另一种方法是使用预打包的 NginX http 到 https<\/em> docker 映像,例如https:\/\/hub.docker.com\/r\/foxylion\/nginx-https-redirect\/<\/a>
<\/blockquote>
services: my-micro-service: image: my-micro-service container_name: my-micro-service ports: - "443:443" # Redirect http traffic to https nginx-redirect: image: foxylion\/nginx-https-redirect ports: - "80:80"<\/code><\/pre>
As you can see, it's very straightforward and easy.如您所见,它非常简单明了。
"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.