My app is running on port 3000, but when try to access my endpoints via my https://site-url, the errorlogs show that i am trying to access static files and i get response from my API,can anyone help me identify the error in my markdown.
#Server blocks for incoming HTTP requests
server {
if ($host = www.tendaafrica.net) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = tendaafrica.net) {
return 301 https://$host$request_uri;
} # managed by Certbot
# server block for 'tendaafrica.net', 'www.tendaafrica.net' domains
listen 80;
listen [::]:80;
server_name tendaafrica.net www.tendaafrica.net;
# redirect any HTTP request to HTTPS
return 301 https://$http_host$request_uri;
}
server {
if ($host = api.tendaafrica.net) {
return 301 https://$host$request_uri;
} # managed by Certbot
# server block for 'api.tendaafrica.net' domain
listen 80;
listen [::]:80;
server_name api.tendaafrica.net;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
server {
# server block for 'static.tendaafrica.net' domain
server_name static.tendaafrica.net;
root /var/www/tenda-main;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/tendaafrica.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/tendaafrica.net/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 {
# server block for all the other requests
# this block will be a default server block listening on port 80
listen 80 default_server;
listen [::]:80 default_server;
# close the connection immediately
return 444;
}
# server blocks for incoming HTTPS requests
server {
# server block for 'tendaafrica.net', 'www.tendaafrica.net' domains
listen [::]:443 ssl;
listen 443 ssl;
server_name tendaafrica.net www.tendaafrica.net;
# SSL configuration by certbot
ssl_certificate /etc/letsencrypt/live/tendaafrica.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/tendaafrica.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
The nginx server works very well, but my app is not served as it should be served