Cannot connect to SSL from outside ubuntu












0















I've got a very strange problem connecting to my newly configured SSL site. This is an Ubuntu VPS hosted on Amazon lightsail.



I have docker container serving port 80 and 443 as you can see here:



CONTAINER ID        IMAGE                                                                           COMMAND                  CREATED             STATUS              PORTS                                      NAMES
ce7114e8383a nginx:alpine "nginx -g 'daemon of…" 43 minutes ago Up 7 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp app_nginx_1
ffe588588a67 registry.gitlab.com/example/example-personal-website:latest "/bin/sh -c 'npm run…" 43 minutes ago Up 7 minutes 0.0.0.0:9000->9000/tcp app_web_1


From inside the server I can make a curl request to that container and get a proper response on SSL. I get this same response on port 80.



ubuntu@ip-172-26-13-199:~$ curl -k https://0.0.0.0:443
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="ie=edge"/>
... // rest of served HTML


I have temporarily disabled the firewall entirely just to rule it out.



ubuntu:~$ sudo ufw disable
Firewall stopped and disabled on system startup
ubuntu:~$ sudo ufw status
Status: inactive


Yet from the outside I cannot access https://www.example.com/ only http://www.example.com/



This is my nginx default configuration so far. It's a reverse proxy to another docker image.



upstream node-app {
server web:9000;
}

server {
listen 80;
listen 443 ssl;

server_name www.example.com;

ssl_certificate /certbot/live/www.example.com/fullchain.pem;
ssl_certificate_key /certbot/live/www.example.com/privkey.pem;

location / {
proxy_pass http://node-app;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}


And this is included by an otherwise default nginx configuration.



user  nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
}


Edit #1 - Output from Test-NetConnection



C:UsersRichard> Test-NetConnection -Port 443 -ComputerName www.example.com -InformationLevel Detailed
WARNING: TCP connect to ([server_ip] : 443) failed
WARNING: Ping to [server_ip] failed with status: TimedOut


ComputerName : www.example.com
RemoteAddress : [server_ip]
RemotePort : 443
NameResolutionResults : [server_ip]
MatchingIPsecRules :
NetworkIsolationContext : Internet
IsAdmin : False
InterfaceAlias : WiFi
SourceAddress : 192.168.1.103
NetRoute (NextHop) : 192.168.1.1
PingSucceeded : False
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded : False

C:UsersRichard> Test-NetConnection -Port 80 -ComputerName www.example.com -InformationLevel Detailed


ComputerName : www.example.com
RemoteAddress : [server_ip]
RemotePort : 80
NameResolutionResults : [server_ip]
MatchingIPsecRules :
NetworkIsolationContext : Internet
IsAdmin : False
InterfaceAlias : WiFi
SourceAddress : 192.168.1.103
NetRoute (NextHop) : 192.168.1.1
TcpTestSucceeded : True









share|improve this question




















  • 1





    There is more than one firewall involved - Understanding public network ports and firewall settings in Amazon Lightsail

    – Steffen Ullrich
    Jan 19 at 15:14













  • Thank you so much. I didn't have to do this on Digital Ocean. Please add your answer so I can give you internet points.

    – Richard Vanbergen
    Jan 19 at 15:24
















0















I've got a very strange problem connecting to my newly configured SSL site. This is an Ubuntu VPS hosted on Amazon lightsail.



I have docker container serving port 80 and 443 as you can see here:



CONTAINER ID        IMAGE                                                                           COMMAND                  CREATED             STATUS              PORTS                                      NAMES
ce7114e8383a nginx:alpine "nginx -g 'daemon of…" 43 minutes ago Up 7 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp app_nginx_1
ffe588588a67 registry.gitlab.com/example/example-personal-website:latest "/bin/sh -c 'npm run…" 43 minutes ago Up 7 minutes 0.0.0.0:9000->9000/tcp app_web_1


From inside the server I can make a curl request to that container and get a proper response on SSL. I get this same response on port 80.



ubuntu@ip-172-26-13-199:~$ curl -k https://0.0.0.0:443
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="ie=edge"/>
... // rest of served HTML


I have temporarily disabled the firewall entirely just to rule it out.



ubuntu:~$ sudo ufw disable
Firewall stopped and disabled on system startup
ubuntu:~$ sudo ufw status
Status: inactive


Yet from the outside I cannot access https://www.example.com/ only http://www.example.com/



This is my nginx default configuration so far. It's a reverse proxy to another docker image.



upstream node-app {
server web:9000;
}

server {
listen 80;
listen 443 ssl;

server_name www.example.com;

ssl_certificate /certbot/live/www.example.com/fullchain.pem;
ssl_certificate_key /certbot/live/www.example.com/privkey.pem;

location / {
proxy_pass http://node-app;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}


And this is included by an otherwise default nginx configuration.



user  nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
}


Edit #1 - Output from Test-NetConnection



C:UsersRichard> Test-NetConnection -Port 443 -ComputerName www.example.com -InformationLevel Detailed
WARNING: TCP connect to ([server_ip] : 443) failed
WARNING: Ping to [server_ip] failed with status: TimedOut


ComputerName : www.example.com
RemoteAddress : [server_ip]
RemotePort : 443
NameResolutionResults : [server_ip]
MatchingIPsecRules :
NetworkIsolationContext : Internet
IsAdmin : False
InterfaceAlias : WiFi
SourceAddress : 192.168.1.103
NetRoute (NextHop) : 192.168.1.1
PingSucceeded : False
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded : False

C:UsersRichard> Test-NetConnection -Port 80 -ComputerName www.example.com -InformationLevel Detailed


ComputerName : www.example.com
RemoteAddress : [server_ip]
RemotePort : 80
NameResolutionResults : [server_ip]
MatchingIPsecRules :
NetworkIsolationContext : Internet
IsAdmin : False
InterfaceAlias : WiFi
SourceAddress : 192.168.1.103
NetRoute (NextHop) : 192.168.1.1
TcpTestSucceeded : True









share|improve this question




















  • 1





    There is more than one firewall involved - Understanding public network ports and firewall settings in Amazon Lightsail

    – Steffen Ullrich
    Jan 19 at 15:14













  • Thank you so much. I didn't have to do this on Digital Ocean. Please add your answer so I can give you internet points.

    – Richard Vanbergen
    Jan 19 at 15:24














0












0








0








I've got a very strange problem connecting to my newly configured SSL site. This is an Ubuntu VPS hosted on Amazon lightsail.



I have docker container serving port 80 and 443 as you can see here:



CONTAINER ID        IMAGE                                                                           COMMAND                  CREATED             STATUS              PORTS                                      NAMES
ce7114e8383a nginx:alpine "nginx -g 'daemon of…" 43 minutes ago Up 7 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp app_nginx_1
ffe588588a67 registry.gitlab.com/example/example-personal-website:latest "/bin/sh -c 'npm run…" 43 minutes ago Up 7 minutes 0.0.0.0:9000->9000/tcp app_web_1


From inside the server I can make a curl request to that container and get a proper response on SSL. I get this same response on port 80.



ubuntu@ip-172-26-13-199:~$ curl -k https://0.0.0.0:443
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="ie=edge"/>
... // rest of served HTML


I have temporarily disabled the firewall entirely just to rule it out.



ubuntu:~$ sudo ufw disable
Firewall stopped and disabled on system startup
ubuntu:~$ sudo ufw status
Status: inactive


Yet from the outside I cannot access https://www.example.com/ only http://www.example.com/



This is my nginx default configuration so far. It's a reverse proxy to another docker image.



upstream node-app {
server web:9000;
}

server {
listen 80;
listen 443 ssl;

server_name www.example.com;

ssl_certificate /certbot/live/www.example.com/fullchain.pem;
ssl_certificate_key /certbot/live/www.example.com/privkey.pem;

location / {
proxy_pass http://node-app;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}


And this is included by an otherwise default nginx configuration.



user  nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
}


Edit #1 - Output from Test-NetConnection



C:UsersRichard> Test-NetConnection -Port 443 -ComputerName www.example.com -InformationLevel Detailed
WARNING: TCP connect to ([server_ip] : 443) failed
WARNING: Ping to [server_ip] failed with status: TimedOut


ComputerName : www.example.com
RemoteAddress : [server_ip]
RemotePort : 443
NameResolutionResults : [server_ip]
MatchingIPsecRules :
NetworkIsolationContext : Internet
IsAdmin : False
InterfaceAlias : WiFi
SourceAddress : 192.168.1.103
NetRoute (NextHop) : 192.168.1.1
PingSucceeded : False
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded : False

C:UsersRichard> Test-NetConnection -Port 80 -ComputerName www.example.com -InformationLevel Detailed


ComputerName : www.example.com
RemoteAddress : [server_ip]
RemotePort : 80
NameResolutionResults : [server_ip]
MatchingIPsecRules :
NetworkIsolationContext : Internet
IsAdmin : False
InterfaceAlias : WiFi
SourceAddress : 192.168.1.103
NetRoute (NextHop) : 192.168.1.1
TcpTestSucceeded : True









share|improve this question
















I've got a very strange problem connecting to my newly configured SSL site. This is an Ubuntu VPS hosted on Amazon lightsail.



I have docker container serving port 80 and 443 as you can see here:



CONTAINER ID        IMAGE                                                                           COMMAND                  CREATED             STATUS              PORTS                                      NAMES
ce7114e8383a nginx:alpine "nginx -g 'daemon of…" 43 minutes ago Up 7 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp app_nginx_1
ffe588588a67 registry.gitlab.com/example/example-personal-website:latest "/bin/sh -c 'npm run…" 43 minutes ago Up 7 minutes 0.0.0.0:9000->9000/tcp app_web_1


From inside the server I can make a curl request to that container and get a proper response on SSL. I get this same response on port 80.



ubuntu@ip-172-26-13-199:~$ curl -k https://0.0.0.0:443
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="ie=edge"/>
... // rest of served HTML


I have temporarily disabled the firewall entirely just to rule it out.



ubuntu:~$ sudo ufw disable
Firewall stopped and disabled on system startup
ubuntu:~$ sudo ufw status
Status: inactive


Yet from the outside I cannot access https://www.example.com/ only http://www.example.com/



This is my nginx default configuration so far. It's a reverse proxy to another docker image.



upstream node-app {
server web:9000;
}

server {
listen 80;
listen 443 ssl;

server_name www.example.com;

ssl_certificate /certbot/live/www.example.com/fullchain.pem;
ssl_certificate_key /certbot/live/www.example.com/privkey.pem;

location / {
proxy_pass http://node-app;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}


And this is included by an otherwise default nginx configuration.



user  nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
}


Edit #1 - Output from Test-NetConnection



C:UsersRichard> Test-NetConnection -Port 443 -ComputerName www.example.com -InformationLevel Detailed
WARNING: TCP connect to ([server_ip] : 443) failed
WARNING: Ping to [server_ip] failed with status: TimedOut


ComputerName : www.example.com
RemoteAddress : [server_ip]
RemotePort : 443
NameResolutionResults : [server_ip]
MatchingIPsecRules :
NetworkIsolationContext : Internet
IsAdmin : False
InterfaceAlias : WiFi
SourceAddress : 192.168.1.103
NetRoute (NextHop) : 192.168.1.1
PingSucceeded : False
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded : False

C:UsersRichard> Test-NetConnection -Port 80 -ComputerName www.example.com -InformationLevel Detailed


ComputerName : www.example.com
RemoteAddress : [server_ip]
RemotePort : 80
NameResolutionResults : [server_ip]
MatchingIPsecRules :
NetworkIsolationContext : Internet
IsAdmin : False
InterfaceAlias : WiFi
SourceAddress : 192.168.1.103
NetRoute (NextHop) : 192.168.1.1
TcpTestSucceeded : True






ubuntu ssl docker nginx vps






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 19 at 19:38







Richard Vanbergen

















asked Jan 19 at 14:54









Richard VanbergenRichard Vanbergen

1035




1035








  • 1





    There is more than one firewall involved - Understanding public network ports and firewall settings in Amazon Lightsail

    – Steffen Ullrich
    Jan 19 at 15:14













  • Thank you so much. I didn't have to do this on Digital Ocean. Please add your answer so I can give you internet points.

    – Richard Vanbergen
    Jan 19 at 15:24














  • 1





    There is more than one firewall involved - Understanding public network ports and firewall settings in Amazon Lightsail

    – Steffen Ullrich
    Jan 19 at 15:14













  • Thank you so much. I didn't have to do this on Digital Ocean. Please add your answer so I can give you internet points.

    – Richard Vanbergen
    Jan 19 at 15:24








1




1





There is more than one firewall involved - Understanding public network ports and firewall settings in Amazon Lightsail

– Steffen Ullrich
Jan 19 at 15:14







There is more than one firewall involved - Understanding public network ports and firewall settings in Amazon Lightsail

– Steffen Ullrich
Jan 19 at 15:14















Thank you so much. I didn't have to do this on Digital Ocean. Please add your answer so I can give you internet points.

– Richard Vanbergen
Jan 19 at 15:24





Thank you so much. I didn't have to do this on Digital Ocean. Please add your answer so I can give you internet points.

– Richard Vanbergen
Jan 19 at 15:24










1 Answer
1






active

oldest

votes


















1














If local connection to port 443 and port 80 from local system is possible but from remote only port 80 can be reached there are usually two possibilities: a) port 443 is bound to a different IP address (not the case here) or b) port 443 is blocked by some firewall.



Note that there can be several firewalls involved here since there are several hops between the remote system and the local system. While you've disabled the firewall on the local system there is at least another one in your setup: Understanding public network ports and firewall settings in Amazon Lightsail.



While some might consider it a nuisance that there is another firewall which need to be explicitly opened, this kind of defense in depth might actually protect several setups where users unknowingly opened databases or other services to the outside.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1396091%2fcannot-connect-to-ssl-from-outside-ubuntu%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    If local connection to port 443 and port 80 from local system is possible but from remote only port 80 can be reached there are usually two possibilities: a) port 443 is bound to a different IP address (not the case here) or b) port 443 is blocked by some firewall.



    Note that there can be several firewalls involved here since there are several hops between the remote system and the local system. While you've disabled the firewall on the local system there is at least another one in your setup: Understanding public network ports and firewall settings in Amazon Lightsail.



    While some might consider it a nuisance that there is another firewall which need to be explicitly opened, this kind of defense in depth might actually protect several setups where users unknowingly opened databases or other services to the outside.






    share|improve this answer




























      1














      If local connection to port 443 and port 80 from local system is possible but from remote only port 80 can be reached there are usually two possibilities: a) port 443 is bound to a different IP address (not the case here) or b) port 443 is blocked by some firewall.



      Note that there can be several firewalls involved here since there are several hops between the remote system and the local system. While you've disabled the firewall on the local system there is at least another one in your setup: Understanding public network ports and firewall settings in Amazon Lightsail.



      While some might consider it a nuisance that there is another firewall which need to be explicitly opened, this kind of defense in depth might actually protect several setups where users unknowingly opened databases or other services to the outside.






      share|improve this answer


























        1












        1








        1







        If local connection to port 443 and port 80 from local system is possible but from remote only port 80 can be reached there are usually two possibilities: a) port 443 is bound to a different IP address (not the case here) or b) port 443 is blocked by some firewall.



        Note that there can be several firewalls involved here since there are several hops between the remote system and the local system. While you've disabled the firewall on the local system there is at least another one in your setup: Understanding public network ports and firewall settings in Amazon Lightsail.



        While some might consider it a nuisance that there is another firewall which need to be explicitly opened, this kind of defense in depth might actually protect several setups where users unknowingly opened databases or other services to the outside.






        share|improve this answer













        If local connection to port 443 and port 80 from local system is possible but from remote only port 80 can be reached there are usually two possibilities: a) port 443 is bound to a different IP address (not the case here) or b) port 443 is blocked by some firewall.



        Note that there can be several firewalls involved here since there are several hops between the remote system and the local system. While you've disabled the firewall on the local system there is at least another one in your setup: Understanding public network ports and firewall settings in Amazon Lightsail.



        While some might consider it a nuisance that there is another firewall which need to be explicitly opened, this kind of defense in depth might actually protect several setups where users unknowingly opened databases or other services to the outside.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 19 at 15:31









        Steffen UllrichSteffen Ullrich

        3,118714




        3,118714






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1396091%2fcannot-connect-to-ssl-from-outside-ubuntu%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Plaza Victoria

            Brian Clough

            Cáceres