I am relatively new to google compute engine and to gunicorn and nginx with django. The problem is that I'm not getting any exceptions but my site doesn't host. I have used django, gunicorn, nginx, certbot/letsencrypt, google domains. The site worked with just gunicorn and nginx before I added google domain and certbot. Now I just get nothing via the browser. I can't tell what the issue is as I can't see anything in the logs. I've looked at part answers to similar problems but nothing seems to work, and I've tried looking at multiple setup articles. Can't seem to find the problem.
NGINX settings:
server {
server_name <domain-name.com> <www.domain-name.com> ;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/ij/djangoapp1;
}
location /media/ {
root /home/ij/djangoapp1;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/<domain-name.com> /fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/<domain-name.com> /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
access_log /var/log/nginx/example.access.log;
error_log /var/log/nginx/example.error.log;
}
server {
if ($host = <www.domain_name.com>) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = <domain-name.com> ) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name <external_ip> <domain-name.com> <www.domain_name.com>;
return 404; # managed by Certbot
netstat -tulpn | grep LISTEN:
(No info could be read for "-p": geteuid()=1003 but you should be root.)
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN -
tcp6 0 0 :::80 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
Firewall rules:
https-outgoing Egress Apply to all IP ranges: 0.0.0.0/0 tcp:443 Allow 1000 default On 3
local Egress Apply to all IP ranges: <internal ip> all Allow 1000 default On 0 No hits
outgoingport Egress Apply to all IP ranges: 0.0.0.0/0 tcp:3000-3999 Allow 1000 default Off— —
allow443 Ingress Apply to all IP ranges: 0.0.0.0/0 tcp:443 Allow 1000 default On 0 No hits
default-allow-http Ingress http-server IP ranges: 0.0.0.0/0 tcp:80 Allow 1000 default Off — —
default-allow-http-3000 Ingress http-server IP ranges: 0.0.0.0/0 tcp:3000-3010 Allow 1000 default Off — —
default-allow-http-8080 Ingress http-server IP ranges: 0.0.0.0/0 tcp:8080 Allow 1000 default Off — —
default-allow-https Ingress https-server IP ranges: 0.0.0.0/0 tcp:443 Allow 1000 default Off — —
default-allow-ip-http-3000 Ingress http-server IP ranges: <internal_ip> tcp:3000-3010 Allow 1000 default Off — —
default-allow2 Ingress Apply to all IP ranges: <internal_ip> all Allow 1000 default On 0 No hits
django8000 Ingress Apply to all IP ranges: 0.0.0.0/0 tcp:8000 Allow 1000 default On 23
jupyternotebook Ingress Apply to all IP ranges: 0.0.0.0/0 tcp:8888 Allow 1000 default On 18
local-new-internal Ingress Apply to all IP ranges: <internal_ip> all Allow 1000 default On 0 No hits
myrule1 Ingress tag1 IP ranges: 0.0.0.0/0 tcp:3004,3005 Allow 1000 default Off — —
myrule2 Ingress tag1 IP ranges: 0.0.0.0/0 tcp:3000-3011 Allow 1000 default Off — —
nginx-plus-http-fw-rule Ingress Apply to all IP ranges: 0.0.0.0/0 tcp:80,8080,443 Allow 1000 default On 3862 2021-01-26
default-allow-icmp Ingress Apply to all IP ranges: 0.0.0.0/0 icmp Allow 65534 default Off — —
default-allow-internal Ingress Apply to all IP ranges: <internal ip> /9 tcp:0-65535 udp:0-65535 icmp Allow 65534 default Off — —
default-allow-rdp Ingress Apply to all IP ranges: 0.0.0.0/0 tcp:3389 Allow 65534 default Off — —
default-allow-ssh Ingress Apply to all IP ranges: 0.0.0.0/0 tcp:22 Allow 65534 default Off — —
NGINX error log doesn't seem to show anything:
/var/log/nginx$ sudo tail error.log
2021/01/25 12:50:49 [notice] 12639#12639: signal process started
2021/01/25 12:51:07 [notice] 12655#12655: signal process started
2021/01/25 12:54:55 [notice] 12772#12772: signal process started
2021/01/25 12:55:08 [notice] 12779#12779: signal process started
2021/01/25 12:55:11 [notice] 12783#12783: signal process started
2021/01/25 12:57:12 [notice] 12842#12842: signal process started
2021/01/25 13:03:18 [notice] 12942#12942: signal process started
2021/01/25 20:06:13 [notice] 1240#1240: signal process started
2021/01/25 20:21:33 [notice] 1578#1578: signal process started
2021/01/25 21:15:52 [notice] 2607#2607: signal process started