How to setup mass dynamic virtual hosts in nginx on docker?

Viewed 952

How can I setup mass dynamic virtual hosts in nginx As seen here except using docker as the host machine?

I currently have it setup like this:

# default.conf
server {
   root /var/www/html/$http_host;
   server_name $http_host;
 }

And in my Dockerfile

COPY default.conf /etc/nginx/sites-enabled/default.conf 

And after I build the image and run it:

docker run -d 80:80 -v www/:/var/www/html 

But when I point a new domain (example.dev) in my hosts file and make a www/example.dev/index.html. It doesn't work at all.

1 Answers
Related