I'm following the example docker compose for an nginx-proxy, but it always returns a 301 Moved Permanently
error. I'm using docker hosted in Ubuntu 22.04.
my docker-compose.yml file
version: '2'
services:
nginx-proxy:
image: nginxproxy/nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ../certificates:/etc/nginx/certs:ro
depends_on:
- whoami
whoami:
image: jwilder/whoami
expose:
- "8000"
environment:
- VIRTUAL_HOST=whoami.media.local
- VIRTUAL_PORT=8000
my test command and output:
user@media:~/docker/nginx-test$ curl -H "Host: whoami.media.local" media.local
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.25.1</center>
</body>
</html>
output from the nginx log
nginx-proxy_1 | nginx.1 | whoami.media.local 192.168.0.2 - - [11/Aug/2023:16:57:07 +0000] "GET / HTTP/1.1" 301 169 "-" "curl/7.81.0" "-"
I've tried adding 192.168.0.2 whoami.media.local
to my host's /etc/hosts
file and the result is the same:
user@media:~/docker/nginx-test$ curl -I whoami.media.local
HTTP/1.1 301 Moved Permanently
Server: nginx/1.25.1
Date: Fri, 11 Aug 2023 17:00:57 GMT
Content-Type: text/html
Content-Length: 169
Connection: keep-alive
Location: https://whoami.media.local/
per the website example, the expected output is: I'm 5b129ab83266
What am I getting wrong in my system configuration?