As the title says, when I go to my website https://example.com it shows my router's log-in page instead of index.html. When I go to a specific page on the website, for example http://example.com/foo.html (notice the http instead of https) it works just fine. Another note: Just going to http://example.com redirects to the https version, so I have to specify http://example.com/index.html to get the default page.

The site was previously working as intended using nginx, but after messing around with Caddy it no longer works. I have since deleted Caddy and reversed to nginx, but it doesn't work as before.

Caddy is a web server that automates getting an SSL certificate. I am not sure how to remove SSL from my site. Maybe by going directly through Let's encrypt? But I don't know how.

I suspect Caddy messed up some settings, but I have no clue as to which and how to fix it.

The website is hosted on a laptop running Ubuntu in my house.

I would really appreciate any help and advice you could give me. Thanks!

NB. I have asked at Server Fault, but it was apparently off topic.

Trimmed content of /etc/nginx/sites-enabled/default:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /home/viktor/website;

    index index.html index.htm index.nginx-debian.html;

    server_name example.com;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;

Trimmed content of /etc/nginx/nginx.conf:

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;

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

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    gzip on;
    gzip_disable "msie6";

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
  • What's the content of "/etc/nginx/sites-enabled/default"? – testeaxeax Jul 28 '17 at 18:57
  • I added it to the main post – loading... Jul 28 '17 at 19:05
  • Content of "/etc/nginx/nginx.conf"? – testeaxeax Jul 28 '17 at 19:11
  • Also added to the post. – loading... Jul 28 '17 at 19:16
  • 1
    Make sure you clear your browser cache. The browser has most likely cached the 301 permanent redirect that Caddy probably used to redirect example.com to example.com Browsers tend to be pretty aggressive in caching 301 redirects. – heavyd Jul 28 '17 at 20:09

Check your router configuration to see if you can disable “administration via the WAN port”. Your router can’t do NAT Loopback on port 443 on the WAN interface if it has its own listener open on port 443 on the WAN interface.

If that doesn’t work out, you almost certainly have a buggy router that doesn’t handle NAT Loopback (a.k.a NAT Hairpinning) correctly for port 443.

If you really need to be able to admin your router from the WAN side, see if you can tell it to put its admin UI web service on an alternate port instead of 443. Let’s say you put it on 50443. Then you can connect to your router’s admin UI going to https://example.com:50443/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.