I want to deploy a site on a digitalocean droplet. So far, it works as expected when I hit the IP address 123.45.678.910, but when I go to my domain name, I see "This site can't be reached, my-site.com refused to connect" on Chrome. I am able to ping mysite.com
and I see that it goes to the right IP address.
I connected my Namecheap domain to my droplet using this tutorial. I've waited 24 hours which I think should be enough time for the domain name to propogate.
I don't see anything recent in the nginx error logs. When I check the status of nginx, gunicorn, and gunicorn.service on the droplet they all appear to be running.
Here's my /etc/nginx/sites-avaliable/my-site
:
listen 80;
listen [::]:80;
server_name my-site.com 123.45.678.910;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /root/my-site/;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
I tried to install an SSL cert with this command:
sudo certbot --nginx -d my-site.com -d www.my-site.com
I don't think it worked, but I'm not sure if this could have something to do with it.
Let me know if there is any more information that you think I should include, I've never done this before so any information is helpful.
Thanks!
EDIT: I'm seeing this in the output of systemctl status nginx
. It's just a warning (famous last words) but I'm wondering if it could be the causes as using the IP address works but the domain name doesn't.
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2023-03-22 00:40:42 UTC; 3min 1s ago
Docs: man:nginx(8)
Process: 185516 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 185527 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 185528 (nginx)
Tasks: 2 (limit: 1131)
Memory: 3.2M
CGroup: /system.slice/nginx.service
├─185528 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─185529 nginx: worker process
Mar 22 00:40:42 my-site systemd[1]: Starting A high performance web server and a reverse proxy server...
Mar 22 00:40:42 my-site nginx[185516]: nginx: [warn] conflicting server name "my-site.com" on 0.0.0.0:80, ignored
Mar 22 00:40:42 my-site nginx[185516]: nginx: [warn] conflicting server name "my-site.com" on [::]:80, ignored
Mar 22 00:40:42 my-site nginx[185527]: nginx: [warn] conflicting server name "my-site.com" on 0.0.0.0:80, ignored
Mar 22 00:40:42 my-site nginx[185527]: nginx: [warn] conflicting server name "my-site.com" on [::]:80, ignored
Mar 22 00:40:42 my-site systemd[1]: Started A high performance web server and a reverse proxy server.