Problem with creating an nginx service in a docker swarm at port 443?


I am trying to create an nginx service with 2 replicas in a docker swarm with 2 nodes in a production environment. The nodes are created in digital ocean.
This nginx service is to act as a reverse proxy (https<–> http) for the apache virtual hosts.
To create the nginx service i use:

docker service create --replicas 2 -p 80:80 --p 443:443 --name webserver --mount type=bind,source=/environments/ssl-env,destination=/etc/nginx/ssl --mount type=bind,source=/conf/nginx.conf,destination=/etc/nginx/nginx.conf --mount type=bind,source=/middleware,destination=/etc/nginx/conf.d nginx

After i run this command the service fails to start, with not any helpful error message. However, only in the worker node the docker daemon listens to port 443:
netstat -tulpn | grep :443
tcp6 0 0 :::443 :::* LISTEN 5797/dockerd

Also, when I comment the https sections in nginx.conf which listen to 443, my nginx service is created and runs successfully, but i want of course to use the https sections. Do you have any idea?
Docker version 17.05.0-ce, build 89658be.
Here is a part of nginx.conf:
server {
listen 80 ;
# redirect http to https ##
rewrite ^ https://$server_name$request_uri permanent;

#server {
listen 443 ;
error_log /var/log/nginx/api_error.log;
access_log /var/log/nginx/api_access.log;

ssl on;
ssl_certificate /etc/nginx/ssl/api.hotelgenius.crt;
ssl_certificate_key /etc/nginx/ssl/api.hotelgenius.key;
ssl_client_certificate /etc/nginx/ssl/api.hotelgenius.cer;

location / {
    proxy_pass http://hotelgenius/;
    proxy_set_header Host $host;
    proxy_redirect http:// https://;



Docker version 17.05.0-ce, build 89658be