Amrit Baveja
Amrit Baveja

Reputation: 608

Port 80 on Flask shows "Welcome to nginx"

I am running a nginx webserver inside Docker (with uwsgi and nginx) and have encountered a problem which I am hoping someone can assist me with. I purchased an SSL certificate and successfully configured in in nginx (when I go to https://localhost, my website renders perfectly). However, when I try to access http://localhost, despite having setup a 301 redirect inside the configuration file, I am greeted with 'Welcome to nginx' in the browser. The /var/log/nginx/access.log records 172.17.0.1 - - [11/May/2018:03:34:37 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3393.4 Safari/537.36 OPR/54.0.2949.0 (Edition developer)" upon the loading of the http version of my site. My nginx server configuration is below:

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

  server_name 0.0.0.0;

  # redirect http to https www
  return 301 https://0.0.0.0$request_uri;
}

server {
  listen [::]:443 ssl http2;
  listen 443 ssl http2;


  # SSL code
    ssl on;
    ssl_certificate /app/ssl/cert.crt;
    ssl_certificate_key /app/ssl/website_name.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!MD5;
    server_name 0.0.0.0;
    location / {
        include uwsgi_params;
        uwsgi_pass unix:/app/myproject.sock;
    }
  # redirect https non-www to https www
}

Any help would be appreciated! Thanks in advance!

Upvotes: 3

Views: 1410

Answers (1)

Thanh Nguyen Van
Thanh Nguyen Van

Reputation: 11772

Please check does any existed file in conf.d folder in nginx docker container. Rename them or delete so that nginx doesnot read these files.

Upvotes: 1

Related Questions