Skip to content

proxy to static nginx:latest container returns 500 always #185

Closed
@H3npi

Description

@H3npi

hi all,

Error description:

i created a docker-compose.yml to proxy a static website through "nginx-web".
The file looks like this:

version: '3.3'
services:
    hvoss.dev:
      container_name: hvoss.dev
      restart: always
      image: nginx:latest
      volumes:
        - "./www:/usr/share/nginx/html:ro"
      environment:
        - VIRTUAL_HOST=hvoss.dev
        - LETSENCRYPT_HOST=hvoss.dev

networks:
  default:
    external:
      name: webproxy

i'd expect that "nginx-gen" generates a config which will proxy-pass to the container, but the generated config looks like this_

# hvoss.dev
upstream hvoss.dev {
				# Cannot connect to network of this container
				server 127.0.0.1 down;
				# Cannot connect to network of this container
				server 127.0.0.1 down;
				## Can be connected with "webproxy" network
			# hvoss.dev
			server 172.19.0.5:80;
}
server {
	server_name hvoss.dev;
	listen 80 ;
	access_log /var/log/nginx/access.log vhost;
	include /etc/nginx/vhost.d/default;
	location / {
		proxy_pass http://hvoss.dev;
	}
}
server {
	server_name hvoss.dev;
	listen 443 ssl http2 ;
	access_log /var/log/nginx/access.log vhost;
	return 500;
	ssl_certificate /etc/nginx/certs/default.crt;
	ssl_certificate_key /etc/nginx/certs/default.key;
}

Steps to reproduce

Setup latest proxy. Create a new dir www. Put a index.html in it.
Create a docker-compose.yml like above.
Start the container docker-compse -up -d

Expected result

a working default.conf should be generated

Error result

  • website is not accessible
  • cannot generate ssl certificate due to error above

Comments

when curling the container on the host machine via the internal ip like curl 172.19.0.5:80 everything works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions