Reputation: 11
I am trying to host my application in angular from docker container. Its working fine with http but not working with https.
1. Created a signed ssl certificate in wsl and generated the .key and .crt files
2. Added the below code to docker file in the application
# Set the working directory
WORKDIR /app
# Add the source code to app
COPY ./ /app/
# Install all the dependencies
RUN npm install
ARG configuration=prod
RUN npm run build:$configuration
FROM httpd:2.4
COPY --from=build-step /app/dist/<appname>/ /usr/local/apache2/htdocs/
3. Created an image using the command: docker build --build-arg configuration=dev . -t <image name>
4. To run the web traffic over ssl used the command for mounting
docker run -p 8235:80 -p 443:443 -v /mnt/c/usr/name/Azure/certificate.crt:/usr/local/apache2/conf/server.crt -v /mnt/c/usr/name/Azure/certificate.key:/usr/local/apache2/conf/server.key <image name>
5. Uncommented the below lines in httpd.conf file present in /usr/local/apache2/conf/httpd.conf
#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#LoadModule ssl_module modules/mod_ssl.so
#Include conf/extra/httpd-ssl.conf
6. Also added the line ServerName localhost in httpd.conf
When tried browsing with http://localhost:8235/ it works fine but when using https://localhost:8235/ it does not work
The logs show the below result:
[Fri Feb 04 10:59:21.854978 2022] [ssl:warn] [pid 1:tid ##########] AH01906: www.example.com:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Fri Feb 04 10:59:21.855031 2022] [ssl:warn] [pid 1:tid ##########] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Feb 04 10:59:21.856743 2022] [mpm_event:notice] [pid 1:tid ##########] AH00489: Apache/2.4.52 (Unix) OpenSSL/1.1.1k configured -- resuming normal operations
[Fri Feb 04 10:59:21.856787 2022] [core:notice] [pid 1:tid ##########] AH00094: Command line: 'httpd -D FOREGROUND'
Upvotes: 1
Views: 8208
Reputation: 9463
Httpd will not run http and https protocols on the same port. As it seems, it is configured to operate on port 80 (http) and port 443 (https). You configured port forwarding as
so you need to test the URLs
http://localhost:8235/
https://localhost:443/
Depending on the certificate you provided the client may warn about an unsafe connection.
Upvotes: 4