Answer the question
In order to leave comments, you need to log in
How to handle all domains through Nginx inside a container?
A container is running on the virtual machine.
Dockerfile
FROM nginx:latest
COPY my.conf /etc/nginx/conf.d/
EXPOSE 80
EXPOSE 443
server {
listen 80;
server_name localhost;
location / {
access_log off;
default_type text/plain;
add_header Content-Type text/plain;
return 200 "localhost alive";
}
}
server {
listen 80;
server_name test.com;
location / {
access_log off;
default_type text/plain;
add_header Content-Type text/plain;
return 200 "test.com alive";
}
}
server {
listen 80;
server_name site.com;
location / {
access_log off;
default_type text/plain;
add_header Content-Type text/plain;
return 200 "site.com alive";
}
}
curl http://localhost
ERR_CONNECTION_REFUSED
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question