docker nginx configuration https can not be accessed

docker nginx configuration https can not be accessed

This question is a bit speechless, if you don't use Docker to install Nginx, you won't encounter it.

If you think about configuring https to use Docker Nginx from the beginning, you should not encounter it.

If you thought about using Docker to install Nginx at the beginning, but didn't consider configuring https, and you suddenly have this requirement later, you are likely to encounter this problem. .

The answer is: Docker must map 443 together when mapping ports! !

Like below.

docker run \
--restart=always \
--name nginx \
-p 80:80 \
-p 443:443 \
-d \
-v ~/dockerdata/nginx:/etc/nginx \
-e TZ="Asia/Shanghai" \
nginx

After searching for a long time, I repeated the process of configuring SSL several times without finding the problem, and then occasionally searched for docker nginx to configure https, and saw that people mapped the 443 population, and I understood it in seconds.

Guess you like

Origin blog.csdn.net/weixin_43734095/article/details/128302836
Recommended