60.Cloud/70.Docker
Docker 테스트 httpd 구성 (ssl 인증서 적용 포함)
왕영주
2020. 11. 30. 14:10
Docker http
Dockerfile
FROM httpd
COPY test1_index /usr/local/apache2/htdocs/index.html
Index page
# cat test1_index
test1 index page
Docker https
Local 인증서 생성
# openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
Dockerfile
FROM ilkka/httpd
# These are self-generated certs not meant for any real use!
COPY cert.pem /usr/local/apache2/conf/server.crt
COPY key.pem /usr/local/apache2/conf/server.key
COPY test1_index /usr/local/apache2/htdocs/index.html
EXPOSE 443
RUN sed -i 's%#\(Include conf/extra/httpd-ssl.conf\)%\1%' conf/httpd.conf \
&& sed -i 's%#\(LoadModule ssl_module modules/mod_ssl.so\)%\1%' conf/httpd.conf \
&& sed -i 's%#\(LoadModule socache_shmcb_module modules/mod_socache_shmcb.so\)%\1%' conf/httpd.conf \
&& sed -i 's%ServerName www.example.com:443%ServerName ${SERVER_NAME}:443%' conf/extra/httpd-ssl.conf
Test
[root@wyj05_deploy_0 ~]# curl -k https://localhost:8443
test1 https server
반응형