We have a ubuntu server. I build my meteor app and run it with pm2. Recently I have a strange behavior concerning the url I put my app on.
I have this domain backtocart.co on godaddy. And I have this subdomain - app.backtocart.co
Whenever I go to that subdomain I get browser response
app.backtocart.co didn’t send any data. ERR_EMPTY_RESPONSE
However in my app inside server I have a redirect from/
route to /login
. And that redirect happens.
On the other hand if I go to my app by the public ip http://217.182.200.46:3001 it just works great!
So I am not even sure why is this problem happening. Because of the app or some server configs?
Here are the dns configs from godaddy.
As you can see the root points to a different ip than the subdomain. On 145.239.24.196
I have nginx server.chatservice.backtocart.co is on nginx as well however it works fine I get nginx response.
I tried to put the app on this domain as well. There I just get a blank page from meteor.
My nginx configs seem to be fine as well. Here are the configs
#proxy_cache_path /home/html_catch levels=1:2 keys_zone=appbacktocartcocatch:2m max_size=50m;
#proxy_cache_key "$scheme$request_method$host$request_uri$is_args$args";
#proxy_cache_valid 200 302 10m;
#proxy_cache_valid 404 1m;
upstream appbacktocartco {
# server localhost:3000;
server localhost:3001;
}
server {
listen 145.239.24.196:80;
server_name app.backtocart.co;
location / {
proxy_cache appbacktocartcocatch;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://appbacktocartco;
proxy_read_timeout 90;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/app.backtocart.co/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/app.backtocart.co/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
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
And here is the general nginx config
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
proxy_cache_path /home/html_catch levels=1:2 keys_zone=appbacktocartcocatch:2m max_size=50m;
proxy_cache_key "$scheme$request_method$host$request_uri$is_args$args";
proxy_cache_valid 200 302 10m;
proxy_cache_valid 404 1m;
include /etc/nginx/sites-enabled/*.conf;
}