I have a website running at https://domain.com and IP a.a.a.a, with an SSL cert issued by GoDaddy. The server is deployed with Nginx. Everything is working fine as it is.
However I'm trying to deploy the same website with Docker in a new server with IP b.b.b.b, so I did the following:
- Pull nginx image from Docker
- Copy the domain.com.chained.crt and domain.com.key files from server a.a.a.a to server b.b.b.b
- In the Docker file, I copy the cert files to the image
- When I run the container and check nginx with
nginx -t, it seems to be working fine.
- Ports 443 and 80 are open for external requests
- I check that the website is running by accessing to b.b.b.b:80 from an external client
- Configure the DNS to resolve to b.b.b.b instead of a.a.a.a
- Check that http://domain.com is working
Up to that point everything is working fine. But when I try to access https://domain.com I get the following errors:
- With firefox: ERR_SSL_PROTOCOL_ERROR
- With chrome: SSL_ERROR_RX_RECORD_TOO_LONG
- The site https://www.sslshopper.com/ssl-checker.html tells me this:
No SSL certificates were found on domain.com. Make sure that the name resolves to the correct server and that the SSL port (default is 443) is open on your server's firewall.
The Nginx error logs don't tell me much, although I have them in debug mode.
My main question is: Can I copy the cert files from one server to another or do I have to generate them again?
Edit: This is the docker-compose.yml
sevices: nginx: build: ./nginx image: nginx ports: - "80:80" - "443:443" redis: image: redis ports: - "6379:6379" mongo: image: mongo ports: - "27017:27017" volumes: - /var/mongodata:/data/db
FROM custom:latest COPY nginx.conf /etc/nginx/nginx.conf COPY /ssl/domain.com.key /etc/nginx/ssl/domain.com.key COPY /ssl/domain.com.chained.crt /etc/nginx/ssl/domain.com.chained.crt RUN apt-get -y install nodejs libssl1.0-dev nodejs-dev node-gyp npm [...] CMD ["nginx", "-g", "daemon off;"]