I'm trying to deploy nginx / gunicorn / flask on ubuntu and all seems to be working when I navigate to "domain.com" but when i go to "www.domain.com" i get the defualt splash screen for nginx.
nginx is setup as below.
server {
server_name thecomputermade.me www.thecomputermade.me;
location / {
include proxy_params;
proxy_pass http://unix:/home/ubuntu/imageRate/imageRate.sock;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/thecomputermade.me/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/thecomputermade.me/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = thecomputermade.me) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name thecomputermade.me;
return 404; # managed by Certbot
}
when i run systemctl status nginx
I get the the below.
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-11-16 08:54:05 UTC; 999ms ago
Docs: man:nginx(8)
Process: 1430 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 1442 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 1443 (nginx)
Tasks: 2 (limit: 560)
Memory: 2.9M
CGroup: /system.slice/nginx.service
├─1443 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─1444 nginx: worker process
Nov 16 08:54:05 ip-172-26-6-186 systemd[1]: Starting A high performance web server and a reverse proxy server...
Nov 16 08:54:05 ip-172-26-6-186 nginx[1430]: nginx: [warn] conflicting server name "www.thecomputermade.me" on 0.0.0.0:443, ignored
Nov 16 08:54:05 ip-172-26-6-186 nginx[1442]: nginx: [warn] conflicting server name "www.thecomputermade.me" on 0.0.0.0:443, ignored
Nov 16 08:54:05 ip-172-26-6-186 systemd[1]: Started A high performance web server and a reverse proxy server.
Notice the line where it says conflicting server name...
I've tried just thecomputermade.me in the nginx config:
- "thecomputermade.me" works as expected but again "www.thecomputermade.me" navigates to the defualt splash screen of nginx.
When I add only "www.thecomputermade.me" in the config:
- both addresses navigate the the default splash and i get the conflicting server name warning.
Does anyone know what I need to do?